File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes File Upload Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "File Upload Error" Watch "File Upload Error" New topic

File Upload Error

vishnu vyasan
Ranch Hand

Joined: May 27, 2008
Posts: 39
Hi Friends,

I am Trying to upload a file to server using appache commons FileUpload. I am getting this exception.

Here is my Code


The code is executing fine till the fi.write(fNew) part of the code. Is it not possible to create a file inside the Application server and write the contents to it?

Any help on this would be appreciated.

Best Regards
Vishnu NV
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Does the "temp" directory exist, and does the user account running the servlet container have access permission to it?

As an aside, it's considered bad design to do stuff like this in a JSP. Much better to do it in a servlet.
vishnu vyasan
Ranch Hand

Joined: May 27, 2008
Posts: 39
Thanks a lot for replying.

There was no temp directoy initialy, i wanted it to create it using the code only. Now i have created one, the code executed fine.
So i think your suggession regarding the rights is correct.

Now i am facing another problem, like when the upload path goes a little deep i am getting exception file not found.

Best regards
Vishnu NV
I agree. Here's the link:
subject: File Upload Error
It's not a secret anymore!