jQuery in Action, 3rd edition
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 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
Sheriff

Joined: Oct 14, 2005
Posts: 19747
    
  10

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
 
It's not a secret anymore!