Zipping Files to user defined Directory

O

OriginalBrownster

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
 
M

Marc 'BlackJack' Rintsch

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
 
O

OriginalBrownster

Marc said:
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?...
 
O

OriginalBrownster

Marc said:
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?...
 
D

Danny Milosavljevic

Hi,

Marc said:
In <[email protected]>,
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top