File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems uploading with Apache FileUpload

 
Ronaldo Nazario
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I'm having problems when testing a simple upload servlet using Apache FileUpload.
This is the code i'm using in my Servlet:



But i'm getting this error message: "\UploadedFiles (The system cannot find the path specified)"
I've tried to insert a complete file name (with name and extension, "UploadedFiles/test.pdf") when instantiating a File object, i've also tried to insert "/" at the beginning of the String, but I always end up with a similar error message.

What am I doing wrong?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Web applications do not have a concept of a default directory, so you need to use absolute paths (which begin with "/" and have the full path starting at the volume root, not the web app root).
 
Ronaldo Nazario
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf. I still have a question though, what is "volume root"?

So, if my application is called "MyApp" I should put "/MyApp/UploadedFiles/"? Is that correct?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is "volume root"?

A better term would have been "file system root", as in Unix all volumes are part of a single file system hierarchy. It is the directory called "/".

if my application is called "MyApp" I should put "/MyApp/UploadedFiles/"? Is that correct?

No. You need an absolute path that starts at the file system root, which may be something like "/usr/local/bin/tomcat-5.5/webapps/MyApp/UploadedFiles", depending on where the server is installed.
 
Ronaldo Nazario
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf, I've changed the String to this path:

C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/Webdisk/UploadedFiles

and now it's working just fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic