I was wondering if someone could help me with a multipart/ form data design issue.
Here's some background on my requirements.
I'm developing a new feature for an application where users are able to create employee profiles, which will consist of all of the employee's details as well as an employee image. A servlet will receive the request; create the employee image on the filesystem, and save the employee details (with the path to the image) to the database. The image is not required but if it is it will need to be of specific type (ie., jpeg, gif), size, and dimensions.
I've considered using the orielly's Multipartparser and Multipartrequest class to do the job, and while they do perform a lot of what I need they don't meet all of my design needs. The reason being that all of the submitted information will have to be validated before proceding to create the image on the file system. So, I've decided to create my own parser.
I've printed out all of the "stuff" so I now I'm able to see that I'll have to parse the "Content-Disposition: form-data" to look for both request parameters and file parts, but I'm not sure what to do with the portion that represents a file. I need to perform validation on the file part: size, dimension, etc.
I suppose u r using file upload facility to send the image file. I think u can try javax.mail.internet.MimeMultiPart through which you can get the InputStream of the Image at the server.After you get the Input Stream you can use the Java Advanced Imaging package
I'd encourage you to move this to a struts environment. In this way you can use an ActionForm on the server side to receive the file. Your ActionForm will override the validate() method and do the appropriate validation. On the JSP side you can use the <html:file> tag to manage your upload.
I do recognize that if you don't already have a struts environment that this is not the best solution.
<a href="http://forums.hotjoe.com/forums/list.page" target="_blank" rel="nofollow">Java forums using Java software</a> - Come and help get them started.