The problem is that you are creating the file in the 'current directory', but chances are that the location is not where you think it is. In each case, try printing the value of new File(".");
As far as I know, reading in files over a web request is not that straight forward. This is so because the request contains additional information (like content-length, encoding etc) and the entire information (including the actual data stream) is available as one big chunk in the request's input stream. That roughly is what is meant by 'multipart/form-data'.
The servlet api has no direct support for reading in multipart form data. You can consider using apache's file upload package.
ram.
Arun Somasundaram
Ranch Hand
Joined: Jul 25, 2006
Posts: 63
posted
0
Thanks Mr.David O'Meara for your suggesstion,as you said the file is created in the different directory i.e, in the Tomcat installation directory.One doubt I have i.e, practically the file has to be created in the current directory but why it doesn't happens.Instead it has been created in the Tomcat installation directory.
Originally posted by ramprasad madathil: As far as I know, reading in files over a web request is not that straight forward. This is so because the request contains additional information (like content-length, encoding etc) and the entire information (including the actual data stream) is available as one big chunk in the request's input stream. That roughly is what is meant by 'multipart/form-data'.
The servlet api has no direct support for reading in multipart form data. You can consider using apache's file upload package.
ram.
This is correct. The file is streamed up to the server as part of multi-part message. That message has to be parse before you can start working with the uploaded file.