• Post Reply Bookmark Topic Watch Topic
  • New Topic

File Upload directory problem  RSS feed

 
Karan Jain
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using Apache commons File Upload utility for uploading a file.
The problem is:

I have deployed the application on a server and trying to access my local file system to upload a file. It is giving me a error that file not found.
When i am using the server directory to browse and upload a file its working perfect.
So how to get the file from my local PC? I must be missing a very small thing as it is so common scenario...

Here is the code...



Its getting into the condition and printing "The input filename is invalid".

Any help is appreciated..

Thanks,
Karan

[ September 06, 2007: Message edited by: Karan Jain ]
[ September 06, 2007: Message edited by: Karan Jain ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code is running on the server so how could it possibly access the file on the client? If you have set up your form correctly as a multi-part form, the file is sent as part of the request. You do not read the file using Java I/O on the file system.

The API for the upload package has all that you need.
 
Karan Jain
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear!!!

I was acting silly...

Regards,
Karan
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!