At 12:26 PM 1/25/99 -0600, David Wagle wrote:
HOW do I code up a page in Zope that will allow the user to use the PUT protocol to upload their own web-page?
You don't need to write support for PUT, Zope already has support for PUT, built-in.
basically I am trying to allow users to create documents, then add meta-data about those documents to a database, and upload the document to hte server.
I'm not totally sure that I understand what you want, but it sounds like this: Have user fill out a form. The form contains a number of fields including a file upload. Some of the form data is used as the content for a new document.
I have a method that aquires the meta-data and creates the folder for the document. However, i don't have an easy way to allow the users to simply provide the file name to upload using a PUT.
If you've already collected the Document content with a file upload, there is no need to use PUT. Here's an example of how to create a Document given a file upload. Basically you need two documents. One to collect the data, 'doc_form', and one to actually create the Document, 'create_doc'. doc_form: <!--#var standard_html_header--> <form action="create_doc" method="post" enctype="multipart/form-data"> id: <input type="text" name="doc_id"--><br> title: <input type="text" name="doc_title"><br> file: <input type="file" name="doc_body:string"><br> <input type="submit"> </form> <!--#var standard_html_footer--> create_doc: <!--#var standard_html_header--> <!--#call expr="manage_addDocument(doc_id,doc_title,doc_body)"--> <h1>Document Added</h1> <p>Document <!--#var doc_id--> added.</p> <!--#var standard_html_footer--> So what's going on here? The first document consists of a form, including a file upload input. Notice that the encoding type is set to "multipart/form-data" this is necessary to use file uploading. Notice also that the action of this form is 'create_doc'. That means the submitted form will be processed by 'create_doc'. Finally notice that the name of the file upload input is 'doc_body:string' this tells ZPublisher to marshal the file upload into a big string. The second Document just makes one call to the Zope API to create the Document. Then it returns some confirmation HTML. The call that does the work is 'manage_addDocument'. How did I figure out the arguments to this method? Simple, I used the on-line object reference which is available under the Help tab on management screens. Of course, you don't have to process your form with DTML. The form could be processed by an external method, for example. In that case the method would look something like this: def create_doc(self,doc_id,doc_title,doc_body): "create a document" # perhaps do some processing here self.manage_addDocument(doc_id,doc_title,doc_body) return "Some confirmation message" Hope this helps. -Amos P.S. PUT is something completely different.