Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to get the complete file name?

807605Aug 31 2007 — edited Sep 4 2007
Good day!

My task is to upload files to the database and also save its path. I am already through with the Blob files but I have a problem with its filename. My boss wants me to get the complete path/location of the file that I am uploading. I mean, she wants to get where it is saved first before I upload it.
Ex.
C:/My Documents/User Files/WebApps/myWebApps/test.txt

currently I am using the following codes:
CODE 1:
	File tempFileRef  = new File(fi.getName());
	System.out.println("Field = "+tempFileRef);
It only outputs:

Field = test.txt

which is not complete

CODE 2:
	File tempFileRef  = new File(fi.getName());
	System.out.println("Field = "+tempFileRef.getAbsolutePath());
which also gives this wrong output:

Field = C:\Tomcat 5.5.23\bin\test.txt


Can someone please help me?
Thanks so much.
God bless.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 2 2007
Added on Aug 31 2007
24 comments
257 views