[Zope-dev] File input retuns what type?

Jason Spisak webmaster@MTEAR.COM
Wed, 08 Sep 1999 18:42:11 -0800


I am trying to upload a file into a property.
I am using code that works to update the property:

My form reads <input type="file" name="file" size="25" value=""> pretty
standard fair.

<!--#if "REQUEST.has_key('file')"-->
<!--#call "propetysheets.ResumeProperties.manage_changeProperties(
	      myproperty=REQUEST['file'].read())"-->
<!--#/if-->

But only when creating a ZClass instance I get this traceback:

Error Type: AttributeError
Error Value: 'string' object has no attribute 'read'

Traceback (innermost last):
  File /Zope/lib/python/ZPublisher/Publish.py, line 214, in publish_module
  File /Zope/lib/python/ZPublisher/Publish.py, line 179, in publish
  File /Zope/lib/python/Zope/__init__.py, line 201, in zpublisher_exception_hook
    (Object: RoleManager)
  File /Zope/lib/python/ZPublisher/Publish.py, line 165, in publish
  File /Zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
    (Object: ResumeClass_add)
  File /Zope/lib/python/ZPublisher/Publish.py, line 102, in call_object
    (Object: ResumeClass_add)
  File /Zope/lib/python/OFS/DTMLMethod.py, line 145, in __call__
    (Object: ResumeClass_add)
  File /Zope/lib/python/DocumentTemplate/DT_String.py, line 502, in __call__
    (Object: ResumeClass_add)
  File /Zope/lib/python/DocumentTemplate/DT_With.py, line 148, in render
    (Object:
ResumeClass.createInObjectManager(_.str(PARENTS[-1].counter), REQUEST))
  File /Zope/lib/python/DocumentTemplate/DT_Util.py, line 321, in eval
    (Object: REQUEST['file'].read())
  File <string>, line 0, in ?
  File /Zope/lib/python/DocumentTemplate/DT_Util.py, line 125, in careful_getattr
AttributeError: (see above)

Doesn't the <input type="file"> return a file object in zope?
The above code works to update the property, why not to create it?
Any ideas?

Jason Spisak
webmaster@mtear.com