hi! fileStore.exists() returns true on your local machine because the file you want to upload is already "uploaded" (fp.getFilePath() returns the full path (on the client) of the file to upload, on your local machine the client is the server, too). On the server-side you cannot check for existance of files on the client-side.
-mw ----- Original Message ----- From: "Jeremy W. Redmond" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, September 10, 2002 4:34 PM Subject: Help with MultipartParser and File Uploads... > I looked through all of the archives and couldn't find an answer.. hopefully I am not doing something stupid. > Everytime I run the code below LOCALLY, it works fine. The minute I try running this on our server, I get the error message from below > "Invalid File Has Been Entered". > Any clue what I am doing wrong? > My final goal is to get "FileStore" variable to contain the File Object for processing. Thanks in advance. > > > > MultipartParser mp = new MultipartParser(hinRequest, 10*1024*1024); // 10MB > Part p; > while((p = mp.readNextPart())!=null){ > if(p.isFile()){ > FilePart fp = (FilePart)p; > String fName = fp.getFilePath(); > if(fName == null || fName.toString().equals("")){ > System.err.println("An Upload File Must Be Specified"); > return; > } > File fileStore = new File(fName); > if(!fileStore.exists()){ > System.err.println("An invalid file has been entered."); > return; > } > fp.writeTo(fileStore); > > ___________________________________________________________________________ > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff SERVLET-INTEREST". > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > Resources: http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html > ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html