This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Java in General and the fly likes Get a full path from a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Get a full path from a file" Watch "Get a full path from a file" New topic
Author

Get a full path from a file

Hernan Tavella
Ranch Hand

Joined: Apr 28, 2012
Posts: 42
Hello, how can i get the absolute path from an FileItem (org.apache.commons.fileupload Interface FileItem) i try several way but i can't get it.

This an example of what i need to do.



the c:\\pruebas\\ i should get it with some method or something.

thanks.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18150
    
    8

I don't understand what "absolute path" you are asking about. From the code you posted, it looks like you wanted an absolute path on the server. But a FileItem object doesn't correspond to any location in the server's file system, it's just a set of bytes which was uploaded from the client system.

There's nothing stopping you from choosing a directory on the server to store the uploaded file in, and in fact that would probably be the best approach.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Get a full path from a file
 
Similar Threads
Uploading Image From JSP Page
Access is Denied
Submit multipart and form data
Java.lang.ClassCastException
upload file through applet