manage_edit or manage_upload help
Hi, I have created a file object from the OFSP product using manage_addFile. This works great. Now I am creating a form to edit the contents of the file. On submitting this form, I want the file data to be updated with what was there in the textarea of the form. Seems simple, and I tried to use manage_edit or manage_upload from my python script. I am unsuccessful in doing this and get Attribute Errors. I would appreciate it if someone could send some example code to help me update the contents of a file object. Thanks Ravneet
Ravneet Sachar wrote:
Now I am creating a form to edit the contents of the file. On submitting this form, I want the file data to be updated with what was there in the textarea of the form. Seems simple, and I tried to use manage_edit or manage_upload from my python script. I am unsuccessful in doing this and get Attribute Errors.
The form should look like: <form action="uploadFile" method="post" enctype="multipart/form-data"> <input type="file" name="file"> <input type="submit" value=" Upload file "> </form> The PythonScript 'uploadFile' which handles the Upload-REQUEST should be something like: ##parameters=file context.manage_upload(file) return context.REQUEST.RESPONSE.redirect('Where/do/you/want/to/go/today') That's it... Cheers, Maik -- Deutsche / German Zope User Group http://www.dzug.org/
Ravneet Sachar wrote:
Hi,
I have created a file object from the OFSP product using manage_addFile. This works great.
Now I am creating a form to edit the contents of the file. On submitting this form, I want the file data to be updated with what was there in the textarea of the form. Seems simple, and I tried to use manage_edit or manage_upload from my python script. I am unsuccessful in doing this and get Attribute Errors.
I would appreciate it if someone could send some example code to help me update the contents of a file object.
You should use the "update_data" method of File object.
participants (3)
-
Maik Jablonski -
Ravneet Sachar -
Vital Lobachevsky