[Zope] Retaining file name in <input type=file...

Simon Blandford home@simonb.org.uk
Sun, 16 Sep 2001 17:24:37 +0000


Hi,

I have a form with a bunch of text boxes and a file browser.

I have a Python function which scans the file selected and fills in the 
text boxes with the result when you press the appropriate action button. 
Then with the text boxes filled in for you, you just press the submit 
button. Problem: the selected file name has disappeared.

I acheive filling in the text boxes in the Python function by using...
REQUEST.set("description", what_i_want_to_go_in_it).

Each text box in the DTML form looks something like this...
<textarea name="description" cols="55" rows="4" wrap="virtual">
<dtml-var expr="REQEST.get('description','')" html_quote></textarea>

This works OK, the problem is I would like the file name to stay put 
when I come back to it. It keeps comming back with a blank box right now.

This is the present DTML...
<input type="file" name="file" size="40"
    value="<dtml-var expr="REQUEST.get('file',')" html_quote>"

...and in the Python function...
REQUEST.set('file', REQUEST.file)
...and I have also tried...
REQUEST.set('file.filename', REQUEST.file.filename)
...neither of which works.

Any suggestions on how to preserve the file name would be most welcome.

Regards,
Simon B.