This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi, I have an HTML page,in which user fills two textboxes(name and biography details) and in third textbox gives the path of an image to be uploaded.How can I upload all the three information to webserver and then save it to a database using JSP thanks vishy
you have many options. you can write the whole database code in the same jsp page, or use a form to submit it to a servlet which will handle it or use a bean that will act as the link to the database. in all options u get the parameters in the textfields using the request.getParameter(name of field); then u can whatever u wish with it.
Joined: Aug 26, 2000
but what about the image,whose path is given in the textbox?what will I have to write to upload the image from the local disk? thanks
Originally posted by vishal sodani: but what about the image,whose path is given in the textbox?what will I have to write to upload the image from the local disk? thanks
when u use the <input type='file'> the actual file gets submitted not just the path in the textbox. Do refer to multipart mimetypes(O'Reiley has one that u can download for free). Also after you have uploaded the image from the clients computer to your webserver u need to save it in the database. if u are using oracle there are specific datatypes u can declare to store images. But my suggestion is to write the image into the webservers hard drive and store the path in the database. regards syd
Joined: Aug 26, 2000
Hi, Can anyone help me with an example with code how to parse a multipart/form-data.In my case,I have two textbox and an image to upload. thanks
You have to use one of the packages that are available out there. It's not that straight forward. O'reilley has one out there, as mentioned previously. You can search this forum or www.google.com for some links.
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley