Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Zipping Files to user defined Directory

Reply
Thread Tools

Zipping Files to user defined Directory

 
 
OriginalBrownster
Guest
Posts: n/a
 
      07-28-2006
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

 
Reply With Quote
 
 
 
 
Marc 'BlackJack' Rintsch
Guest
Posts: n/a
 
      07-28-2006
In <(E-Mail Removed) .com>,
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


 
Reply With Quote
 
 
 
 
OriginalBrownster
Guest
Posts: n/a
 
      07-28-2006

Marc 'BlackJack' Rintsch wrote:
> In <(E-Mail Removed) .com>,
> 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?...

 
Reply With Quote
 
OriginalBrownster
Guest
Posts: n/a
 
      07-28-2006

Marc 'BlackJack' Rintsch wrote:
> In <(E-Mail Removed) .com>,
> 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?...

 
Reply With Quote
 
Danny Milosavljevic
Guest
Posts: n/a
 
      09-02-2006
Hi,

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

> Marc 'BlackJack' Rintsch wrote:
>> In <(E-Mail Removed) .com>,
>> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating directory and zipping it Raju Aralikatti Ruby 7 01-08-2008 11:53 AM
#if (defined(__STDC__) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) Oodini C Programming 1 09-27-2005 07:58 PM
Zipping large group of files? Kenny Computer Support 7 06-02-2004 10:37 PM
Zipping a directory Kasper K Java 1 12-22-2003 11:22 AM
Zipping many files -- each file into its own zip file with same name k* Computer Support 14 07-15-2003 12:26 PM



Advertisments