Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

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 upload file to server on specific path ?

843840Sep 18 2007 — edited Sep 19 2007
Hi ,

Friends i have written code to check on local machine to upload , using apache commons file upload.
its working good.

but when i m giving path for web server it is not uploaded on server, what will be the reason ?

dirName = request.getContextPath()+"/uploads" ;

since i want to upload my all files to my : WebAPP_ROOT/uploads

when i am printing using

request.getContextPath( ) +"/uploads" its showing me correct path, but file is not uploading.

I have another issue but might its not secure , as it is showing real physical path to dir

dirName = application.getRealPath("/");

also tell me how secure this is ? it will take by default ROOT HOME to :

WebAPP_ROOT / build/web instead i want WebAPP_ROOT/uploads

provide me solution for this.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 17 2007
Added on Sep 18 2007
7 comments
706 views