image uploading problems: changing of object type
hi!!! I am facing this situation. I upload images in to a ftp upload enabled folder. My task is to base64 encode the images and put it into another directory. I base64 encode the files using the external method. When i upload it, ZOPE takes the default type as image. Now if i rename the file into a *.dat file, then the encoding works. Now can i change the type of the object from "image" to ordinary "file" from a script python. Please help!! regards, R K ===== with "freedom" comes great responsibilities __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail
From: "R Karthick" <catchkarthick@yahoo.com>
I upload images in to a ftp upload enabled folder. My task is to base64 encode the images and put it into another directory. I base64 encode the files using the external method. When i upload it, ZOPE takes the default type as image. Now if i rename the file into a *.dat file, then the encoding works.
Now can i change the type of the object from "image" to ordinary "file" from a script python.
You can change the content type when you add the object: contentType = 'image/jpeg' folder.manage_addFile(id=thisId, file=filedata, title=afile, content_type=contentType) You can set contentType to any valid MIME type. HTH Jonathan
hi!! thank you for you reply. Infact i changed the content-type to text/xml. Eventhough the content_type of the file changes, it still remains an "Image" and that gives me problems. Can i change the type of the file using some api function? It is like changing the type from dtml-method to zpt file. similarly from Image to ordinary "file". Regards, R K --- Jonathan Hobbs <toolkit@magma.ca> wrote:
From: "R Karthick" <catchkarthick@yahoo.com>
I upload images in to a ftp upload enabled folder. My task is to base64 encode the images and put it into another directory. I base64 encode the files using the external method. When i upload it, ZOPE takes the default type as image. Now if i rename the file into a *.dat file, then the encoding works.
Now can i change the type of the object from "image" to ordinary "file" from a script python.
You can change the content type when you add the object:
contentType = 'image/jpeg' folder.manage_addFile(id=thisId, file=filedata, title=afile, content_type=contentType)
You can set contentType to any valid MIME type.
HTH
Jonathan
===== with "freedom" comes great responsibilities __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail
From: "R Karthick" <catchkarthick@yahoo.com>
thank you for you reply.
Infact i changed the content-type to text/xml. Eventhough the content_type of the file changes, it still remains an "Image" and that gives me problems. Can i change the type of the file using some api function? It is like changing the type from dtml-method to zpt file. similarly from Image to ordinary "file".
You could try the 'update_data' api routine (details can be found in the zope book). Jonathan
--- Jonathan Hobbs <toolkit@magma.ca> wrote:
From: "R Karthick" <catchkarthick@yahoo.com>
I upload images in to a ftp upload enabled folder. My task is to base64 encode the images and put it into another directory. I base64 encode the files using the external method. When i upload it, ZOPE takes the default type as image. Now if i rename the file into a *.dat file, then the encoding works.
Now can i change the type of the object from "image" to ordinary "file" from a script python.
You can change the content type when you add the object:
contentType = 'image/jpeg' folder.manage_addFile(id=thisId, file=filedata, title=afile, content_type=contentType)
You can set contentType to any valid MIME type.
HTH
Jonathan
===== with "freedom" comes great responsibilities
__________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
I get this error when updating an RDFSummary instance. Not right away but after zope is running for a while. If I restart zope then I can update OK for a while, but then after several hours the error comes back! zope 2.6.2 (with included python 2.1), CMF 1.4.2, plone 2.0RC5, RDFSummary 4.2p1 here's the traceback: xception traceback Time 2004/07/12 11:48:37.103 GMT-4 User Name (User Id) admin (admin) Request URL http://www.bowery.com/protest/News/bowery/update Exception Type TypeError Exception Value unbound method __init__() must be called with instance as first argument Traceback (innermost last): * Module ZPublisher.Publish, line 98, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 39, in call_object * Module Products.RDFSummary.RDFSummary, line 328, in update * Module Products.RDFSummary.RDFSummary, line 802, in parse_url * Module urllib2, line 135, in urlopen * Module urllib2, line 318, in open * Module urllib2, line 297, in _call_chain * Module urllib2, line 826, in http_open * Module urllib2, line 818, in do_open * Module urllib, line 805, in __init__ TypeError: unbound method __init__() must be called with instance as first argument
participants (3)
-
Jonathan Hobbs -
Marc Lindahl -
R Karthick