[Zope] Problems using forms to upload files to Zope
Tino Wildenhain
tino at wildenhain.de
Tue Nov 15 09:57:48 EST 2005
Mike Jakowlew schrieb:
> Here's what I'm trying to accomplish:
>
> 1. The user fills out a form page with various fields
> 2. The user selects a file to upload
> 3. when the user hits submit two things should happen:
> - The file selected is uploaded
> - all the filled out form fields are written to the database (MS SQL)
>
> This is my current problem:
> The writting to the database part works fine on it's own, but when
> combined with the file upload I get this error
>
> *Error Type: AttributeError*
> *Error Value: 'NoneType' object has no attribute 'headers'*
>
>
> My code:
>
> *********HTML FORM**********
> <html>
> <h1 tal:content="template/title">title</h1>
> <p>Fill out the form below to update the website with the appropriate
> info:</p>
>
> <form action="uploadForm.py">
^^^^ here is the problem
You need enctype="multipart/form-data"
compare it with filelibrary example or the ZMI
fileupload which basically does the same.
> <table width="100%" border="0" cellspacing="0" cellpadding="0">
> <tr>
> <td width="16%" height="27" align="right"><strong>Your Dept:
> </strong></td>
> <td width="84%"><input type="text" name="department"></td>
> </tr>
... *snip* ---
HTH
Tino
More information about the Zope
mailing list