File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Oreilly File Upload package problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Oreilly File Upload package problem" Watch "Oreilly File Upload package problem" New topic

Oreilly File Upload package problem

Stephen Wei
Ranch Hand

Joined: Oct 09, 2001
Posts: 73
Hello all:
I am using Oreilly MultipartRequest package to upload file. What I found is that if user inputs a file which actually does not exist on the client computer, the file actually gets uploaded successfully. (Saved on the server with empty body).
Has anyone experienced above problem? I think a normal handle to this would return an exception to user. But the MultipartRequest package seems not to check the existence of the file on the client computer. How do I deal with this? Can I check the existence of the file on the client computer on the server side? I know with ASP this could be done, but I can only use JSP or Javascript, or server side Java.
Can someone teach me a solution? thanks.

Sun Certified Programmer for Java Platform
Mike Nightsky
Ranch Hand

Joined: Aug 18, 2001
Posts: 48
How should the MultiPartRequestPackage check the existance of the file. It has no access to your local machine, it resides on the server.
TCP/IP is a stateless protocoll, that means no open connections will be kept and could later accessed. A lost connection between Client and server wount disturbe the server at all.
The only way to prevent uploading non existing files is, per javascript in the form, or after uploading check for the length of the uploaded file.

Win the opportunity to make money on the Internet<br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: Oreilly File Upload package problem
It's not a secret anymore!