Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Mozilla takes out path of file - Problem! - need full file path for Upload

843842Nov 19 2008 — edited Nov 24 2008
There are pages on my site that process the uploading and storing of files (images) from the client's computer, and while IE leaves the full path of the file (like C:\myphotos\jpeg\example.jpg), Mozilla only passes the name of the file (like example.jpg), which is no good! I need to have the full path of the image file in order for it to work.

How do I fix this issue?

Here is a snippet of my servlet code, within the code I commented where the problem occurs...halting my servlet from continuing to process...but only in Mozilla.
//.....
List items = upload.parseRequest(request); // Create a list of all uploaded files.				
Iterator it = items.iterator(); // Create an iterator to iterate through the list.																					
			
while(it.hasNext()) {				     				
	FileItem item = (FileItem)it.next();
        File f = new File(item.getName()); // Create a FileItem object to access the file.
        //THE STATEMENT BELOW HALTS THE REST OF THE SERVLET FROM PROCESSING
        //BECAUSE THE FILE PATH IS INCOMPLETE
	FileInputStream fs = new FileInputStream(f); 
//...
Any input is appreciated,
Love2Java
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2008
Added on Nov 19 2008
9 comments
289 views