Putting a default value in an <input type="file"...>
Hi, I got a PageTemplate form with a control scripts. In case of control failure, the form is published again with an error message and the previous values of the fields. This is easy for usual widgets (textfields, radio, checkboxes...) but I'm stuck with <input type="file" value=...> controls, for which I can't give back the previous value (file path in the client file system). Any hint ? I know this is not strictly a Zope problem but I guess some of you already faced that problem. Thanks in advance. --Gilles
Gilles Lenfant wrote:
Hi,
I got a PageTemplate form with a control scripts.
In case of control failure, the form is published again with an error message and the previous values of the fields.
This is easy for usual widgets (textfields, radio, checkboxes...) but I'm stuck with <input type="file" value=...> controls, for which I can't give back the previous value (file path in the client file system).
Any hint ?
I know this is not strictly a Zope problem but I guess some of you already faced that problem.
I don't know wheter it's possible to write anything in the input box of an <input type="file" ...>, but I can tell you that zope can't in any way help you with that, because from a standards pov, the browser doesn't send the path information to the server. cheers, oliver
Hi Gilles, Gilles Lenfant wrote: ...
This is easy for usual widgets (textfields, radio, checkboxes...) but I'm stuck with <input type="file" value=...> controls, for which I can't give back the previous value (file path in the client file system).
Any hint ?
I know this is not strictly a Zope problem but I guess some of you already faced that problem.
Thanks in advance. Yes, this is a HTML/security problem. If the browser does it well, it does not allow modification of file fields from server. Neither via value nor via Javascript. You can imagine what would happen if some attacker would provide a path to a system file, your back account file or whatever and hides the form element somewhere in the page?
You guess it. Regards Tino Wildenhain
participants (3)
-
Gilles Lenfant -
Oliver Bleutgen -
Tino Wildenhain