Ok , what I am trying to do is get an image from the form I submit and store it in a database. (don't ask why or
you should store it not in a database just a directory)
<input type=file ...> is on my form and when I click the submit button I can use getParameter to get the value of my text based fields , checkbox's ,...etc
But when uploading a file ... It just gives me the name of the file not the contents.
So I need away to get the contents of this upload ,i.e the binary.
So then I tried the function response.getInputStream and I was able to write a simple parser that extracts the image from the html body submitted data and allows me to write it to a database as I wanted.
My problem now is I will have to parse thru all the other fields that I could easily have gotten from using getParameter....
Since the
java doc clearly say you can use only one or the other getParameter , getInputstream .
So I am stuck between a rock and a hard place since my parser will probably not be portable for many different webserver if I host it on different sites/computers.
Is their anyway of using getParameter to get my fields like normally and some other function to get the binary/contains of the uploaded file so I can write it into my databases BLOB filed for the images.
Without having to use just getInputStream and write a parser each time to get contents of an uploaded file?
I have been using
j2ee 1.5 but I have noticed that j2ee 1.6 has a getPart function. Wondering if that function is the one that will do what I want. I would be willing to upgrade to that if it is true.
Does anybody no for sure?
Also if I can use getParts to do it then can it be used with getParameter at the same time or am I stuck with using one or the other.