Hi, need some help here, i have a program where a user can input name, city and upload image. when a user click the submit button the name, city and the image(Save as BLOB) must be save in the database. and the image will also save in the desired folder. i have no problem in saving the image in the folder, my problem is it can't save the record to mysql database.
but when i try to input the record manually to the code like this it will successfully save... see difference in line 53-54(code at the top) from 51-52(here) and i remove some code in line 39-40
And what are the symptoms of your problem? It appears from what you wrote that the record is not being written to the database, but that isn't very helpful. Especially when you have debugging code in place already, which you aren't telling us about.
Actually my from now i can upload the image and it successfully save in my database, my problem is, i can't save the text input to my database.. it always appear NULL.
so it means the my STRING Name = request.getParameter("name") is not working..
my question is, how can i saved this text input to my database, is it ok if try to use another connection just to get the value of the text input.?
all i want from now is to save that text input to my database.
To me it looks like you're processing a multipart request with that code. I've done that, but I never considered trying to parse the request myself. Instead, I used the Apache FileUpload package which works just fine and I don't have to hack around with boundaries or any of that. And it can store the file upload in a temporary file if you ask it to do so.
Anyway, one feature of multipart request is that what you think of as "parameters" (i.e. the HTML form fields which aren't file uploads) are not treated as request parameters. One of your code samples appeared to be assuming that they were. But they aren't. They are just another "part" of the request (or maybe one part per parameter, I don't know) so you're going to have to extract them from the request in just the same way as you extracted the file upload.