Jump to content

Multiple File Download through HTTP using PHP


mfrac@witsusa.com

Recommended Posts

Hi:

I am attempting to do mulitple file downloads using a web browser. The best I could come up with was down loading 1 file (see code below). How would I download 3 files from-server-to-client? For example download 3 files in succession: my_file1.bmp, my_file2.bmp, my_file3.bmp?

Here is my code for 1 file downloading:

[code]
<?php
$filename = "my_file.bmp";
$mimetype = 'image/bmp';
$data = file_get_contents($filename);
$size = strlen($data);
header("Content--Disposition: attachment; filename = $filename");
header("Content--Length: $size");
header("Content--Type: $mimetype");
echo $data;
?>

[/code]
Note, Could not post code (being blocked for some reason) with header correctly having a single hyphen (-).

Some additonal info:
1. Trying to only use a web browswer, not relying on a ftp.
2. Trying to avoid zipping the files at the server.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.