473,785 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Zipping Files to user defined Directory

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

Jul 28 '06 #1
4 1426
In <11************ **********@p79g 2000cwp.googleg roups.com>,
OriginalBrownst er 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
Jul 28 '06 #2

Marc 'BlackJack' Rintsch wrote:
In <11************ **********@p79g 2000cwp.googleg roups.com>,
OriginalBrownst er 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?...

Jul 28 '06 #3

Marc 'BlackJack' Rintsch wrote:
In <11************ **********@p79g 2000cwp.googleg roups.com>,
OriginalBrownst er 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?...

Jul 28 '06 #4
Hi,

On Fri, 28 Jul 2006 05:25:38 -0700, OriginalBrownst er wrote:
Marc 'BlackJack' Rintsch wrote:
>In <11************ **********@p79g 2000cwp.googleg roups.com>,
OriginalBrowns ter 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
Sep 2 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1723
by: Russell E. Owen | last post by:
I'm writing a cross-platform app. Presently it runs on unix and MacOS X, but eventually I'd like to get it working on Windows (nothing older than 2000). For unix and MacOS X I store settings in ~/.TUIPrefs and ~/.TUIGeom and allow extensions to be stored in ~/TUIAdditions/ and <app's parent dir>/TUIAdditions/. Is the home dir easily accessible from vanilla Python (and if so, how do I get there)? Is there a better directory (I'm really...
11
2763
by: Steven T. Hatton | last post by:
In the past there have been lengthy discussiions regarding the role of header files in C++. People have been very adamat about header files serving as in interface to the implementation. I do understand the objective. This example may represent an interface in need of a bit of refactoring, but it goes to demonstrate the basic idea as I understand it. http://developer.kde.org/documentation/library/cvs-api/kdevelop/html/ast_8h-source.html...
0
1171
by: Benjamin Bittner | last post by:
hallo ng, first of all, for the zipping progress i use the ziplib from http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx now to my problem. im trying to build a little application for zipping our webservers logfiles. after zipping all files, i've tried to delete all files, but i couldnt. i got an error message that i cannot delete a file, because it is still in use. Here my two functions for that:
1
431
by: RJN | last post by:
Hi Does .Net provide libraries for zipping files? I read that a third party component CSharplib is available for doing this. Is there any license restriction for using this? Thanks rjn
6
5038
by: reidarT | last post by:
I will develop a backup routine with local files (zipped) to an internet server via ftp. How do I zip files in Vb.net? reidarT
5
2132
by: OriginalBrownster | last post by:
This will probably sound like a very dumb question. I am trying to zip some files within a directory. I want to zip all the files within a directory called "temp" and have the zip archive saved in a directory with temp called ziptemp I was trying to read up on how to use the zipfile module python provides, but I cannot seem to find adequate documentation on function itself.
5
2915
by: Jandre | last post by:
Hi I am a python novice and I am trying to write a python script (most of the code is borrowed) to Zip a directory containing some other directories and files. The script zips all the files fine but when it tries to zip one of the directories it fails with the following error: "IOError: Permission denied: 'c:\\aaa\\temp'" The script I am using is:
2
1083
by: Brian Vanderburg II | last post by:
I've installed Python 2.5 on MSW and it works. I'm preparing it to run from a thumb drive so I can run applications by dropping them onto the python.exe or from command line/etc. It works but the size is quite large. I've compressed most of the executables with UPX even the dlls under site-packages, but is there a way I could compress the top-level 'lib' directory into a python.zip instead so save some space, and do I need the 'test'...
1
1326
by: Bouzy | last post by:
I wrote this script... #!/usr/bin/python # Filename: backup_zip.py import os, zipfile, time, datetime, glob from os.path import splitext, relpath, split r = 1 cwd = os.getcwd()
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9489
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10162
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.