Here's less of a long shot: <form method=post action=script enctype="multipart/form-data"> Make sure you have the enctype. If that doesn't work, try: <input type=file name="file:file"> I don't think that's necessary, but I've seen stranger things before. Kevin -----Original Message----- From: Jason Spisak <webmaster@MTEAR.COM> To: Kevin Dangoor <kid@kendermedia.com> Cc: zope-dev@zope.org <zope-dev@zope.org> Date: Wednesday, September 08, 1999 10:34 PM Subject: Re: [Zope-dev] File input retuns what type?
Kevin,
I changed the name of the form element, and the code refering to it to a wacky word, and I get the same traceback.
It just wants to make that form element a string. I tried different browsers/platforms too.
All my best,
jason
Kevin Dangoor wrote:
This is a shot in the dark, but did you try a field name other than
"file"?
That sounds so generic, I'm wondering if Zope has something else defined that is interfering. Another way to know for sure would be to reference REQUEST.form['file']
Kevin
-----Original Message----- From: Jason Spisak <webmaster@MTEAR.COM> To: zope-dev@zope.org <zope-dev@zope.org> Date: Wednesday, September 08, 1999 9:58 PM Subject: [Zope-dev] File input retuns what type?
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
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://www.zope.org/mailman/listinfo/zope-dev
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For non-developer, user-level issues, zope@zope.org, http://www.zope.org/mailman/listinfo/zope )
Kevin, That did it! I always put that in all my forms, and this was something I just threw together, and left it out. It was blowing my mind. You are great. All my best, jason Kevin Dangoor wrote:
Here's less of a long shot:
<form method=post action=script enctype="multipart/form-data">
Make sure you have the enctype.
If that doesn't work, try: <input type=file name="file:file">
I don't think that's necessary, but I've seen stranger things before.
Kevin
-----Original Message----- From: Jason Spisak <webmaster@MTEAR.COM> To: Kevin Dangoor <kid@kendermedia.com> Cc: zope-dev@zope.org <zope-dev@zope.org> Date: Wednesday, September 08, 1999 10:34 PM Subject: Re: [Zope-dev] File input retuns what type?
Kevin,
I changed the name of the form element, and the code refering to it to a wacky word, and I get the same traceback.
It just wants to make that form element a string. I tried different browsers/platforms too.
All my best,
jason
Kevin Dangoor wrote:
This is a shot in the dark, but did you try a field name other than
"file"?
That sounds so generic, I'm wondering if Zope has something else defined that is interfering. Another way to know for sure would be to reference REQUEST.form['file']
Kevin
-----Original Message----- From: Jason Spisak <webmaster@MTEAR.COM> To: zope-dev@zope.org <zope-dev@zope.org> Date: Wednesday, September 08, 1999 9:58 PM Subject: [Zope-dev] File input retuns what type?
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
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://www.zope.org/mailman/listinfo/zope-dev
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For non-developer, user-level issues, zope@zope.org, http://www.zope.org/mailman/listinfo/zope )
participants (2)
-
Jason Spisak -
Kevin Dangoor