File Upload Problem

M

mee-shell

I have a page with the file upload as the following:

<form action="UploadConfirm.psp" method="post"
enctype="multipart/form-data">
<input type="file" name="UploadFile"><br><br>
<a href="javascript:document.forms[0].submit();">submit</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('UploadFile'):
TheFile = form['UploadFile']
filename = TheFile.filename

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top