0

FileSelectbox java where is the full pathname stored?

asked 2013-03-07 11:10:09 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2013-03-07 15:59:12 +0800

Hi all,

i need to call a fileselectbox in pure java which returns the filename and the full pathname of the file.

I played with :

media = Fileupload.get();
System.out.println(media.getName());

I'm missing the getter for the full pathname. Can anyone help me on this?

thanks Stephan

delete flag offensive retag edit

Comments

4 Answers

Sort by ยป oldest newest most voted
0

answered 2013-03-11 06:17:08 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

See Stackoverflow for security reason you can not do it.

link publish delete flag offensive edit
0

answered 2013-03-08 04:45:22 +0800

vincentjian gravatar image vincentjian
2245 6

Did you mean you want to get the client's file path like "d:\ccc\" ? I think it is not possible due to security issue.

link publish delete flag offensive edit
0

answered 2013-03-07 16:16:00 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2013-03-07 16:49:15 +0800

I select the file in Chrome (FileUpload) from d:\ccc\queries.pdf and get as result:

Media media;
media = Fileupload.get();
File file = new File(media.getName());

System.out.println("file.getName(): " + file.getName());
System.out.println("file.getPath(): " + file.getPath());
System.out.println("file.getCanonicalPath(): " + file.getCanonicalPath());
System.out.println("file.getAbsolutePath(): " + file.getAbsolutePath());




log:
file.getName(): queries.pdf
file.getPath(): queries.pdf
file.getCanonicalPath(): D:\Entwicklung\queries.pdf
file.getAbsolutePath(): D:\Entwicklung\queries.pdf

any idea are welcome.

By deploying the war-file on an external Tomcat Instance. I get as log result for the Path the Tomcat Directory:

D:\Tomcat_7........\bin\queries.pdf

link publish delete flag offensive edit
0

answered 2013-03-07 11:16:50 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2013-03-07 16:02:24 +0800

Edit:

media = Fileupload.get();
System.out.println(media.getName());

File file = new File(media.getName());
System.out.println(file.getAbsolutePath());

Tested with Tomcat started from Eclipse it gives me the path where my eclipse start.bat is in?????

link publish delete flag offensive edit

Comments

You can edit your question as well . Rather than adding it in answer section

sjoshi ( 2013-03-11 06:18:03 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-03-07 11:10:09 +0800

Seen: 21 times

Last updated: Mar 11 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More