struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel J. D'Cotta" <daniel.jos...@gridnode.com>
Subject RE: FormFile/DiskFile and form validation/redisplay during file upload
Date Fri, 12 Jul 2002 02:44:12 GMT
Charles,

>Also, it does not appear that the original filename is guaranteed to be
supplied either

FormFile has a method getFileName() which returns you the filename (without
any path). Trying to obtain the client's path is not possible from an <input
type="file/> tag; because this could lead to hacking, etc.


Regards,
Daniel

-----Original Message-----
From: Galpin, Charles [mailto:charles.galpin@digitalpaper.com]
Sent: Thursday, July 11, 2002 10:09 PM
To: 'struts-user@jakarta.apache.org'
Cc: Scalio, Jim; Spyker, Jason
Subject: FormFile/DiskFile and form validation/redisplay during file
upload


Hi All

I've searched the list for this issue, and only found one thread that was
related (pre-setting the file value), but didn't really address this issue.

I have a form with a file input as well as other inputs (assume they are
metadata associated with the file).

If the user enters a path to a file and submits, and my validation checks on
the other inputs return ActionErrors for those inputs, the form is
redisplayed but the file value is not retained.

If I view the source, I see

<input type="file" name="file" size="50"
value="org.apache.struts.upload.DiskFile@12a19e">

So it looks like DiskFile needs a toString() implemented that returns this
path. BUT, I think this is not going to be as easy to fix as it sounds. The
DiskFile class only has the original filename and the full server side path,
but not the original client side path.

Am I missing something, or does anyone know how I can get the full client
side path to the file? I scrounged around the upload source a bit, but can't
see where this would be done. Also, it does not appear that the original
filename is guaranteed to be supplied either ( see
http://www.ietf.org/rfc/rfc1867.txt)

Oh, I am running the nightly snapshot (20020711) to get past other file
upload problems under weblogic 7.0.

Thanks
charles





--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message