Hiya.. i posted before but heres the prob in more detail..

I'm making a JSP page where (ideally) you select files to upload, each selected file is added to a listbox. The form is submit, (along with some other parameters), and the files are uploaded. They arent uploaded (written) tradionally to a server, I just need the file's input stream to pass to a method elsewhere (which will upload to a database).
The page has a file-input type to locate files to upload. Once a file is selected (onChange()), the filename is added to a listbox

<SELECT NAME="listfiles" MULTIPLE>

and there is a button which submits the form. The form submits to itself (so it will submit to the same jsp page)

<FORM NAME="formname" ACTION="uploadpage.jsp" METHOD="post" enctype="multipart/form-data">

On my local machine, I can open the page, select a file and submit -- the page loads fine. When on the web server, when I submit -- the page will go have an error -- the typical 'this page cannot be displayed' error which is shown a page's cant be found. I have absolutely no idea why! To me, it should simply load that page again. Some of the time it does this, and other times (most times) it just turns blank -- I can't work out why.
Similarly when I try to submit (on local machine) and just take the file-input value, eg with

MultipartRequest multi = new MultipartRequest(request, ".");
params = multi.getFileNames();

and enumerate through and display the value of any files -- it shows the browse button's name but its value is always 'null' even though something was entered there. This won't be a problem if I don't need to get the filename through here to upload it as the other parameters (from the select box) come through fine with

Enumeration params = multi.getParameterNames();

where name="listfiles"
This is very frustrating and I really would appreciate help, particularly if I'm going about this the wrong way. Is it even possible to use filenames supplied in the listbox to get a local file's input stream or does it have to be a file-input type.

Thanks a lot

This article has been dead for over six months. Start a new discussion instead.