Okay I corrected:

<form action="" method="post" enctype="multipart/form-data">

and also tried the getContentType, but I get the error:

Error Type: AttributeError
Error Value: FileUpload instance has no attribute 'getContentType'

def content_type(self):
    return self.getContentType()

def writeDB():
    # get sql method

    department = REQUEST.form.get('department')
    title = REQUEST.form.get ('title')
    filename = REQUEST.form.get('upload_filename')

    upload_contents= content_type(filename)

    if content_type.find('image')!=-1:
        context.manage_addImage(id, file, title)
        context.manage_addFile(id, file, title)
    return 'Finished'

    version = REQUEST.form.get('version')
    url = "">    ownerapp = REQUEST.form.get('ownerapp')
    isoapp = REQUEST.form.get('isoapp')
    comments = REQUEST.form.get('comments')
    date = REQUEST.form.get('date')

    filename = filename.split('\\')[-1]

    # call it, passing arguments
    insert( department=department, title=title, filename=filename, version=version, url="" ownerapp=ownerapp, isoapp=isoapp, comments=comments, date=date)

    # return a confirmation page
    page=container['thanks.html ']
    return page()


On 11/15/05, Mike Jakowlew <[EMAIL PROTECTED]> wrote:
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**********
<h1 tal:content="template/title">title</h1>
<p>Fill out the form below to update the website with the appropriate info:</p>

<form action=""><table width="100%"  border="0" cellspacing="0" cellpadding="0">
    <td width="16%" height="27" align="right"><strong>Your Dept: </strong></td>
    <td width="84%"><input type="text" name="department"></td>
    <td height="27" align="right"><strong>Document Title:</strong></td>
    <td><input type="text" name="title"></td>
    <td height="30" align="right"><strong>Filename:</strong></td>
    <td><input type="file" name="upload_filename" ></td>
    <td height="28" align="right"><strong>Version of File :</strong></td>
    <td><input type="text" name="version"></td>
    <td height="28" align="right"><strong>URL:</strong></td>
    <td><input type="text" name="url"></td>
    <td height="33" align="right"><strong>Owner Approved:</strong></td>
    <td><input type="text" name="ownerapp"></td>
    <td align="right"><strong>ISO Approved:</strong></td>
    <td><input type="text" name="isoapp"></td>
    <td height="41" align="right"><strong>Comments: </strong></td>
    <td rowspan="2"><textarea name="comments" cols="60" rows="5">
    <td height="85" align="right" valign="top">&nbsp;</td>
    <td height="29" align="right"><strong>Date</strong></td>
    <td><input type="text" name="date"></td>
    <td height="62" align="right"></td>
      <input type="submit" id="submit" name="submit" />

<p>Return to the <a href="" page</a></p>

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to