This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I had faced a similar scenario to yours a while back. First let me explain what happens to a file when you upload it to the server, it gets stored in a temporary folder where it is kept for access just at runtime only. The only issue is that it is a temp folder. When your file uploader thread is done with the uploading , if you do not save the file of reference it from another thread, it will most probably get deleted or stored in some temp cache folder that you wont be able to locate at all ( atleast this is what happened with me but I was using JBOSS server ). Now the temp folder of tomcat is the work directory located at $CATALINA_HOME$/work and the complete location to the work directory specific to your project will be $CATALINA_HOME$/work/Catalina/localhost/<project_context_name>/ .
That said , lets come to the upload part , when you upload a file via form , it will be present in this work directory . Now when you upload it , it will appear in the work directory but it will be deleted after the upload thread gets done with it , so what you will do is that you will save it. Once saved, you can do whatever you like with it .
Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
MS IE, security hazard, need we say more? Anyway the link is broken.
In any event, the file upload in HTTP doesn't allow the server to open the client file. Instead the HTTP client opens the client file, copies its contents to the HTTP MIME data stream, and the server caches the bytes until the server application figures out what it wants to do with the data. Which may or may not involve saving that data (verbatim or modified) to a server-side file at the whim of the application programmer.
The "file name" is simply another data item in the uploaded MIME data stream, and can actually be any string that the client application sets it to. It's simply that the accepted/expected value of that string is the name of the file.
An IDE is no substitute for an Intelligent Developer.