Kelvin Cheong writes:
 > Anybody know where I can find out more about LocalFS, I've already read
 > jfarr's How-to's and Product Information. But I still need more on how it
 > works. 

It helps to pay very careful attention to the help info (in
.../Products/LocalFS/methodHelp.dtml if you're not running 2.2 yet).
Beyond that, there's only the source...

 > <!--#var standard_html_header-->
 > <H2><!--#var title_or_id--> <!--#var document_title--></H2>
 > <P>
 > <dtml-with REQUEST>
 >      <dtml-call "REQUEST.set('userTABPIX1',REQUEST.form['userTABPIX1'])">
 >      <dtml-call "manage_addImage('',userTABPIX1)">
 > </dtml-with>
 > <!--#call "TutadobeInsertMethod(REQUEST)"-->
 > Data Has Been Successfully Inserted!
 > <!--#var standard_html_footer-->
 > I tried replacing (blindly) the <dtml-with REQUEST> tag with both
 > <dtml-with myLocalFS1> and <dtml-in myLocalFS1>, and as to my expectations
 > it did not work. How would I actually upload to the LocalFS object
 > (myLocalFS1) I've created?

To programatically upload a file you need to:

1. Get the file info in a FileUpload object.  The normal way to do
this is via a form input tag of type "file".

2. Call myLocalFS1.manage_upload(file, REQUEST).  For dtml, that would 
look something like: <dtml-call "myLocalFS1.manage_upload(file, REQUEST)">.

Warning, the current official version of manage_upload will try to
display a MessageDialog page that will send you to the management
pages if REQUEST is not None.  I've patched my version to redirect
back to 'index_html' instead, which makes much more sense if you allow 
users without management rights to upload files.

For a very useful sample, the default LocalFS index_html page is
.../Products/LocalFS/methodBrowse.dtml.  It includes an upload link
that uses manage_uploadForm, which is a standard Zope method defined
in several files in .../lib/python/OFS.  I think that the one this
page will use is defined in to be documentUpload.dtml in 
the same directory.

Hope this helps,

Dan Pierson

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to