Hmmm. Sounds rather like a browser issue to me. You might want to see what
is actually being passed in that request - if its actually a valid multipart
request or not!

I had a try in IE, but IE's file selector is too smart to allow selection of
a folder as the upload file. Which browser are you using?

-----Original Message-----
From: Joe Germuska [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 17 February 2004 00:13
To: Struts Users Mailing List
Subject: Re: FileUploading Error


At 9:35 AM -0500 2/16/04, Mark Shifman wrote:
>In trying to bulletproof file uploading I noticed something odd.
>
>If I type some junk in the field for the file name and hit Submit, I get
>a file of size 0. I can deal with that.  If I type in a directory name
>in my home directory (admittedly a dumb thing to type) nothing seems to
>happen and I get this error in my log file.
>
>ERROR 2004-02-13 14:09:18,679
>handleRequest(CommonsMultipartRequestHandler.java:241)
>Failed to parse multipart request
>org.apache.commons.fileupload.FileUploadException: Processing of
>multipart/form-data request failed. Stream ended unexpectedly
>...
>
>This error seems to be thrown before it even gets to my UploadAction.
>How do I catch this and tell the user the file typed in is invalid?

In Javascript, the "value" of the form field is the path to the file;
you might be able to apply a mask validation testing for a reasonable
filename -- this is far from perfect, but may help.  I use this as a
cheap way to get around the lack of support for the "accepts"
attribute -- I test to see if the file has a "right extension" using
the mask validator.

Just one thought...

Joe

--
Joe Germuska
[EMAIL PROTECTED]
http://blog.germuska.com
       "Imagine if every Thursday your shoes exploded if you tied them
the usual way.  This happens to us all the time with computers, and
nobody thinks of complaining."
             -- Jef Raskin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to