How download all files from folder in php?

All, I allow users to upload images to my website. For that user I'd like to download all of the images that the user uploaded to my site from my website. So I'd like to basically have a dropdown of the usernames and then when I select one query my database and obtain all of the images that they downloaded. That part is no issue.

My issue is that how can I go through each of these files and put them into a zip folder and then download the zip folder [if that's possible].

Any ideas on how to go about doing something like that?

Thanks in advance!

EDIT: I know how to download the file once it's zipped by using the following code:

header['Content-Type: application/zip'];
header['Content-disposition: attachment; filename=filename.zip'];
header['Content-Length: ' . filesize[$zipfilename]];
readfile[$zipname];

asked Jul 10, 2012 at 19:31

user1048676user1048676

9,45625 gold badges80 silver badges118 bronze badges

1

Thanks to the help from @maxhud I was able to come up with the complete solution. Here is the final code snippet used to achieve my desired results:


answered Jul 10, 2012 at 20:11

user1048676user1048676

9,45625 gold badges80 silver badges118 bronze badges

answered Jul 10, 2012 at 19:34

Max HudsonMax Hudson

9,84714 gold badges54 silver badges104 bronze badges

1

I want to know how to create a download file from the database/folder. What I want to have is that I have two files butangDonload.php and download.php. When the user clicks the word "download" the pop-up box should appear and save the file. 

The butangDonload.php:

Can someone please help me with this?

How to download file from Folder in php?

php $name= $_GET['nama']; download[$name]; function download[$name] { $file = $nama_fail; if [file_exists[$file]] { header['Content-Description: File Transfer']; header['Content-Type: application/octet-stream']; header['Content-Disposition: attachment; filename='.

How to download any file Using php?

PHP enables you to download file easily using built-in readfile[] function. The readfile[] function reads a file and writes it to the output buffer..

Chủ Đề