I have a page with the file upload as the following:
<form action="UploadC onfirm.psp" method="post"
enctype="multip art/form-data">
<input type="file" name="UploadFil e"><br><br>
<a href="javascrip t:document.form s[0].submit();">sub mit</a><br><br>
</form>
after submit, I'd like to retrieve the file name, and I have written
something like this:
<%
import sys
import os
if form.has_key('U ploadFile'):
TheFile = form['UploadFile']
filename = TheFile.filenam e
else:
TheFile = 'No file was uploaded, im empty'
filename = ''
%>
when I tested it, I got an error after submitting a file, and the
error message was:
AttributeError: 'StringField' object has no attribute 'filename'
Can anyone tell me what cause the problem and how I can fix it?
Thanks a lot.
<form action="UploadC onfirm.psp" method="post"
enctype="multip art/form-data">
<input type="file" name="UploadFil e"><br><br>
<a href="javascrip t:document.form s[0].submit();">sub mit</a><br><br>
</form>
after submit, I'd like to retrieve the file name, and I have written
something like this:
<%
import sys
import os
if form.has_key('U ploadFile'):
TheFile = form['UploadFile']
filename = TheFile.filenam e
else:
TheFile = 'No file was uploaded, im empty'
filename = ''
%>
when I tested it, I got an error after submitting a file, and the
error message was:
AttributeError: 'StringField' object has no attribute 'filename'
Can anyone tell me what cause the problem and how I can fix it?
Thanks a lot.