hi I am preparing a web site using zope; I am quite of a newbie I would find it useful if it would be possible to store files in the real filesystem what I am thinking of is: I would like to have a class RealFile that is similar to the usual File, such that the content of the file is stored somewhere in the real filesystem or otherwise a class RealFolder that is similar to the usual Folder, such that, when a File is created into it, the content of the file is stored somewhere in the real filesystem; the reason for the above is that 1) I need to manage very large files (postscript PDF and such) and 2) I need to process these files with standard Unix tools is there any existing external method that does the job? thanks for any advice a.m. ps: please reply to me too, I am not subscribed to this list -- Andrea Mennucc "E' un mondo difficile. Che vita intensa!" (Renato Carotone)
On Mon, 25 Mar 2002, Jud Dagnall wrote:
Try the ExtFile or LocalFS products. They both allow you to store files outside of Zope. To add one more for confusion issues: ExternalFile seems to target the same job.
I did not test all three but I will have to use one of them for the following purpose: My application has to store images and descriptional informations about those images. For all description stuff I would like to use PostgreSQL but I would like to store the images themselves in the local file system and just the complete path in the database (quite usual for this purpose if I'm informed correctly). Now I have to create image file objects dynamically from my application which has kind of "Upload image" mechanism. I would like to have an easy to use create_externel_image method but the documentation how to do that is quite sparse for all three products. Some examples, how to do that would be helpful. Moreover I would like to have a comparison of the differences of these three just to decide for the right one for my application. Kind regards Andreas.
Now I have to create image file objects dynamically from my application which has kind of "Upload image" mechanism. I would like to have an easy to use create_externel_image method but the documentation how to do that is quite sparse for all three products.
Some examples, how to do that would be helpful.
I used the ExtFile product so that I could save some metadata about each file in Zope (although I didn't end up adding the extra metadata). AFAIK Local File System doesn't allow one to do that. However, be careful with the storage directory method you use if you choose ExtFile. I set ExtFile to mirror the Zope directory structure. However, later on in the development process, I wanted to change my Zope folder structure. This caused problems: Zope kept looking for the objects where they had been created even though I moved the disk files into the new directory. I assume ExtFile stores the directory path at creation time, and it should only be a matter of identifying this attribute and then modifying it programmatically. However, since I was still using test files I just deleted the orphans in Zope and on disk. I used the ExtFile add file page as a basic template (since I wanted to have my own interface). Here's the code. It's really primitive, but got the job done for me: My HTLM add_file_form (minus formatting): ===Begin====================== <form action="add_file_action" method="post" enctype="multipart/form-data" name="form"> <br />Title:<br /><input type="text" name="title" size="40"> <br />Notes:<br /><input type="text" name="descr" size="40"> <br /><input type="file" name="file" size="25" value=""> <br /><input type="submit" value=" Add "> </form> ===End====================== my dtml method add_file_action (minus error checking). I wanted to store the new items in a subfolder called downloads. ===Begin====================== <dtml-with REQUEST> <dtml-let id="''"> <dtml-var expr="downloads.manage_addProduct['ExtFile'].manage_addExtFile( id, title, descr, file)"> </dtml-let> </dtml-with> <dtml-var standard_html_header> Success! <dtml-var standard_html_footer> ===End====================== I was playing around with some code to add and set unique properties at creation time. I've got that code is somewhere, if you're interested, although the project eventually got dropped. HTH Jud -- Jud Dagnall SGI Electronic Services jdagnall@sgi.com 650.933.7256
participants (3)
-
Andrea Mennucc -
Jud Dagnall -
Tille, Andreas