Arvind
Arvind

Reputation: 6474

java- obtain full path to file selected by a user for upload

I am trying to create a simple screen where the file selected for upload by the user is assigned to a file variable.

Google Data APIs have a class "MediaFileSource" which uses "File" to store a file. Given below is code to assign an image file to a MediaFileSource object.

MediaFileSource myMedia = new MediaFileSource(new File("/home/liz/puppies.jpg"), "image/jpeg");

What I want to do is, ask the user to specify an image for upload, and then assign that image(chosen by the user using my web app) to the MediaFileSource variable. I just need the full path to that image (which was chosen by the end user) to assign it to a MediaFileSource variable.

What is the best way to do this? I plan to create the above functionality in a java web application on Google App Engine.

Upvotes: 0

Views: 161

Answers (1)

Shay Erlichmen
Shay Erlichmen

Reputation: 31928

You can't get the full path on the user machine, only the file name.
It's for security reason and its not related to Google App Engine.

Upvotes: 1

Related Questions