[Zope] Newbie question on uploading/downloading files

Robert Rottermann robert@redcor.ch
Mon, 8 Jul 2002 21:05:39 +0200


Zope can not do that directly. I does not actually deal with the
os-filesystem but mimmics its own which resides in ZODB.
So if you want to deal with the "real" filesystem you have to write either
an external method or a product.
An external method would be something like this:

def createdir(path):
    """ a method to create a directory """
    import os
    try:
        os.mkdir(path)
        return 'went well'
    except:
        return 'failed'

This  method you put into a file in Zopes Extensions directory (eg as
mkdir.py) from where you can access it as an external script.

Robert
----- Original Message -----
From: "Doug Chamberlin" <DChamberlin@AndoverSoftware.com>
To: <zope@zope.org>
Sent: Monday, July 08, 2002 8:31 PM
Subject: [Zope] Newbie question on uploading/downloading files


> I have a test site running which extracts records from an external
> database, displays them on a page, and allows updating of fields. So far
so
> good.
>
> Now I need to provide a way for the user to upload a file, list what files
> have been uploaded, and download a selected file. These files need to be
> stored in the server's file system (Windows 2000) and each is related to a
> record in the database by a primary key value (which is an integer).
>
> My strategy is to create a sub directory in the file system for each
> record, as it is being created, which is the primary key value. All
> associated uploads will go into that sub directory.
>
> First question is how do I create a sub directory in the server's file
system?
>
> I have looked at the localFS product intending to pull techniques from it
> but I've just gotten more confused as I look at it. Any pointers to
> specific examples which would be better to look at? Any HowTo's which
cover
> this stuff?
>
>
>
>
>
> _______________________________________________
> 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 )
>