[Zope] Serving external files

Allen Wallis allen@rrsg.ee.uct.ac.za
Tue, 28 Mar 2000 12:45:14 +0200


Tony McDonald wrote:

> At 10:09 am +0200 28/3/00, Allen Wallis wrote:
> >Hi,
> >I have some questions about serving external files:
> >The zope id of the external method is "getFile".
> >
> >I have a dtml method that calls this external method, using
> ><dtml-var "getFile(REQUEST, RESPONSE)">
> >The id of this dtml method is "download".
> >Say I have a dtm document with something like
> ><a href="download">SomeFile.dat</a>
> >
> >This works, and the file is downloaded correctly. I want to know firstly
> >whether there is a better way of achieving this.
>
> Yes. Use the LocalFS product, it's taken care of a lot of the things
> that you're battling with (I've done the same thing and am in the
> process of moving to LocalFS).
>
> >Secondly, when the user clicks on the SomeFile.dat hyperlink, and the
> >browser's "save as" dialog pops up, the browser uses the id of the dtml
> >method "download" as the filename in the dialog. Obviously I would
> >rather this dialog shows the name of the file that will be downloaded.
> >How can I change this? I can't rename the dtml method suitable for each
> >different filname that might be downloaded, so where else can I alter
> >this behaviour?
>
> Again, LocalFS will do this for you (my main reason for switching!).
>
> hth
> tone
> ------
> Dr Tony McDonald,  FMCC, Networked Learning Environments Project
> http://nle.ncl.ac.uk/
> The Medical School, Newcastle University Tel: +44 191 222 5888
> Fingerprint: 3450 876D FA41 B926 D3DD  F8C3 F2D0 C3B9 8B38 18A2
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

Thanks -
I have downloaded LocalFS, but haven't tried anything substantial with it,
my reason being that I needed to upload these external files as well.
A user must be able to upload a file, which will be saved to the local file
system, and made available for download from the local file system. The
actual path to the file will be stored in a relational database (along with
a whole lot of other info). If I were to use the LocalFS product for this,
is it possible to add a LocalFS object dynamically (through some dtml method
that gets called when a user uploads a file)? Or (better?), is it possible
to set up a LocalFS object dynamically only when a user wants to download a
particular file (once finished the LocalFS object is deleted). I ask since,
in my case there might be many files that are uploaded, and I'm not sure
what limits there are on the number of LocalFS objects that can be
maintained.

Any comments appreciated!
thanks
Allen