Zipping Files to user defined Directory

Discussion in 'Python' started by OriginalBrownster, Jul 28, 2006.

  1. Hi There.

    I'm very new to python, and I have been using the TurboGears Framework
    to use python to power my application.

    I have a class which handles the upload of a file to a directory called
    "uploads", which is hosted on a server.

    my problems is that when I want to download that file from the server I
    want to zip the files selected. but how does a user specify where they
    want to save that file?.

    I the user will be selecting the files they want to download and I want
    to zip those files and let the user save it.

    I want to know how to let the user specify where to save the zipped
    files.

    Any ideas?..any python to help me do this?? i know i can use the
    zipfile module but I can't figure out the part about letting the user
    decide.

    Thank you

    Stephen Sandhu
     
    OriginalBrownster, Jul 28, 2006
    #1
    1. Advertising

  2. In <>,
    OriginalBrownster wrote:

    > I'm very new to python, and I have been using the TurboGears Framework
    > to use python to power my application.
    >
    > […]
    >
    > my problems is that when I want to download that file from the server I
    > want to zip the files selected. but how does a user specify where they
    > want to save that file?.


    Usually the browser asks the user for a target directory. So that's not
    your business.

    After the user selected the files you have to zip them on the server, for
    instance in a temporary in the `/tmp/` directory and then deliver that
    archive to the user.

    Ciao,
    Marc 'BlackJack' Rintsch
     
    Marc 'BlackJack' Rintsch, Jul 28, 2006
    #2
    1. Advertising

  3. Marc 'BlackJack' Rintsch wrote:
    > In <>,
    > OriginalBrownster wrote:
    >
    > > I'm very new to python, and I have been using the TurboGears Framework
    > > to use python to power my application.
    > >
    > > [...]
    > >
    > > my problems is that when I want to download that file from the server I
    > > want to zip the files selected. but how does a user specify where they
    > > want to save that file?.

    >
    > Usually the browser asks the user for a target directory. So that's not
    > your business.
    >
    > After the user selected the files you have to zip them on the server, for
    > instance in a temporary in the `/tmp/` directory and then deliver that
    > archive to the user.
    >
    > Ciao,
    > Marc 'BlackJack' Rintsch



    THanks Marc,

    That makes sense. I can zip the files to a temp directory. However,
    How do I deliver the archive to them?...
     
    OriginalBrownster, Jul 28, 2006
    #3
  4. Marc 'BlackJack' Rintsch wrote:
    > In <>,
    > OriginalBrownster wrote:
    >
    > > I'm very new to python, and I have been using the TurboGears Framework
    > > to use python to power my application.
    > >
    > > [...]
    > >
    > > my problems is that when I want to download that file from the server I
    > > want to zip the files selected. but how does a user specify where they
    > > want to save that file?.

    >
    > Usually the browser asks the user for a target directory. So that's not
    > your business.
    >
    > After the user selected the files you have to zip them on the server, for
    > instance in a temporary in the `/tmp/` directory and then deliver that
    > archive to the user.
    >
    > Ciao,
    > Marc 'BlackJack' Rintsch



    THanks Marc,

    That makes sense. I can zip the files to a temp directory. However,
    How do I deliver the archive to them?...
     
    OriginalBrownster, Jul 28, 2006
    #4
  5. Hi,

    On Fri, 28 Jul 2006 05:25:38 -0700, OriginalBrownster wrote:

    > Marc 'BlackJack' Rintsch wrote:
    >> In <>,
    >> OriginalBrownster wrote:
    >>

    [...]
    >> After the user selected the files you have to zip them on the server,
    >> for instance in a temporary in the `/tmp/` directory and then deliver
    >> that archive to the user.
    >>
    >> Ciao,
    >> Marc 'BlackJack' Rintsch

    >
    >
    > THanks Marc,
    >
    > That makes sense. I can zip the files to a temp directory. However, How
    > do I deliver the archive to them?...


    Like you deliver any other content in a cgi (assuming you are using a cgi):
    By printing in on standard output.

    I don't know "TurboGears" though.

    cheers,
    Danny
     
    Danny Milosavljevic, Sep 2, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kasper K

    Zipping a directory

    Kasper K, Dec 22, 2003, in forum: Java
    Replies:
    1
    Views:
    1,510
    Harald Hein
    Dec 22, 2003
  2. Doug Tolton

    Zipping and Unzipping files

    Doug Tolton, Nov 21, 2003, in forum: Python
    Replies:
    1
    Views:
    319
    Peter Hansen
    Nov 21, 2003
  3. OriginalBrownster

    Zipping files/zipfile module

    OriginalBrownster, Aug 2, 2006, in forum: Python
    Replies:
    5
    Views:
    469
    Brian Beck
    Aug 2, 2006
  4. Oodini
    Replies:
    1
    Views:
    1,779
    Keith Thompson
    Sep 27, 2005
  5. Raju Aralikatti

    creating directory and zipping it

    Raju Aralikatti, Jan 8, 2008, in forum: Ruby
    Replies:
    7
    Views:
    182
    Andrew Timberlake
    Jan 8, 2008
Loading...

Share This Page