472,354 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

Downloading multiple files in single zip file

I am developing the project management system.

Each Project:
1. Title, description ... , stored in mysql database
2. Upto ten files (initial description), (name in db, file in file
system)
3. Message board, stored in mysql database (1 file per message, message
in db, file in file system)

I need a link (Download Project) which will download all the project
related files, description, message board in the single zip file.

Please suggest any appropriate method about it.

zlib is installed.

Apr 20 '06 #1
4 5057
You can either dynamically create the project archive everytime a user
requests to download it, which would result in a horrible server load,
or cache the archives and have them updated nightly or whe a project
admin requests an update, for example.

Apr 20 '06 #2

ye*********@gmail.com wrote:
I am developing the project management system.

Each Project:
1. Title, description ... , stored in mysql database
2. Upto ten files (initial description), (name in db, file in file
system)
3. Message board, stored in mysql database (1 file per message, message
in db, file in file system)

I need a link (Download Project) which will download all the project
related files, description, message board in the single zip file.

Please suggest any appropriate method about it.

zlib is installed.


That's a problem that I used as an example in my article about the PHP
stream interface:
http://www.phparch.com/sample.php?mid=42

Apr 20 '06 #3
Hi,

I have used the similar code as listed in the listing 2.txt

------------------------------------------------------
include_once ($path.'includes/flyzip/flyzip.php');
include_once ($path.'includes/flyzip/functions.php');

unset($file_list);

AddFolder(&$file_list, $path."uploads/temp", "projdwnld");

//AddFolder(&$file_list, $path."uploads/temp",
$path."uploads/projdwnld");
//$DEBUG = true;

if(!isset($DEBUG)) {
$zip = new FlyZip($path."uploads/projdwnld/".'proj'.$id.'.zip');
foreach($file_list as $src => $dest) {
$zip->AddFile($dest, $src);
}
$zip->EchoToClient();
} else {
foreach($file_list as $src => $dest) {
copy($src, $dest);
}
}
---------------------------------------------------------------------------------------------

if I use $DEBUG = true, then the files are successfully coped to the
specified download folder. But when it is not set, it prints the output
on the browser window as

PKPz߄fʀprojdwnld/test.txt㥢岴 q
Rqt򱕈HΈ̋)-ΏO..(ʏ*)JLΎ-JЋHKMMIrr‹ӓ€z\\œ2sRʒ‹€z‹4 ŒLʹ􂽼¬y©dvAbI.󑐀Pz߄fʀPKPz߄fʀpro jdwnld/Copy
of test.txt㥢岴 q
Rqt򱕈HΈ̋)-ΏO..(ʏ*)JLΎ-JЋHKMMIrr‹ӓ€z\\œ2sRʒ‹€z‹4 ŒLʹ􂽼¬y©dvAbI.󑐀Pz߄fʀPKPz߄fʀ
projdwnld/test.txtPKPz߄fʀ ¢projdwnld/Copy of test.txtPKˆL
How can I save those files in the single zip file.
I have tested the following code for creation of zip file.

$fname = "proj".$id."-".date("Y-m-d H-i-s").".bz2";
touch($path."uploads/projdwnld/".$fname);
$fp = bzopen($path."uploads/projdwnld/".$fname, "w");
bzwrite($fp, "this is a test");
bzclose($fp);

The abobe code produces the bz2 file.


Chung Leong wrote:
ye*********@gmail.com wrote:
I am developing the project management system.

Each Project:
1. Title, description ... , stored in mysql database
2. Upto ten files (initial description), (name in db, file in file
system)
3. Message board, stored in mysql database (1 file per message, message
in db, file in file system)

I need a link (Download Project) which will download all the project
related files, description, message board in the single zip file.

Please suggest any appropriate method about it.

zlib is installed.


That's a problem that I used as an example in my article about the PHP
stream interface:
http://www.phparch.com/sample.php?mid=42


Apr 21 '06 #4
Thanks.

I was opening the link directly from the browser. Like I tried the link
http://localhost/pms/projects/fulldwnld.php?id=48 in the address bar
and due to it it was giving output as specified in the message.

Later when I checked by clicking on the link "Download", the "File
Download" alert window came and I was able to save the file.

Thanks again.

Manish

Apr 21 '06 #5

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

Similar topics

4
by: googlinggoogler | last post by:
Hiya, The title says it all really, but im a newbie to python sort of. I can read in files and write files no probs. But what I want to do is read in a couple of files and output them to one...
2
by: Gopal | last post by:
I am using ASP.NET and i wish to push down 3 files (text/xml) from the server to the client. I wish to give the user an option to select the folder in which we wants these files to be dumped. Any...
4
by: KenFehling | last post by:
Hello. I am wondering if there exists a piece of software that takes multiple .js files that are nicely indented and commented and create one big tightly packed .js file. I'm hoping the one file...
1
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call...
3
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call...
5
by: fniles | last post by:
We created an ActiveX control and marked it as safe for scripting using Implements IObjectSafety. We then created a CAB file and signed it using Verisign. We also created a license file (LPK file)...
1
by: Maury | last post by:
Hello, I would like to download multiple files with one click in a web form link, I know how to download a single file, and I think that a solution is to zip all the files in an archive, and then...
6
by: Joseph Geretz | last post by:
I have the following class which I am serializing and passing back and forth between my Web Service application and the client. public class Token : SoapHeader { public string SID; public...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made but the http to https rule only works for...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...

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.