PDA

View Full Version : Saving images on a webpage to a file



nealrm
02-07-2012, 12:00 PM
I would like to setup a page to allow users to download all the files on a page to a user selected folder. The goal is to make this very simple - click button, select folder, save.I do not want to force the users to install any add-in, extension, etc. There may be 40 to 140 photos for them to download, so don't want them to repeat the save for each image. Javascript or PHP coding is OK.

Any suggestions or hints to point me in the right direction?

technowonder
02-07-2012, 12:25 PM
Hi,

An easy way to do this is to provide all the images in a ZIP file format which means they can download a single ZIP file containing all the images. Windows and Mac can open ZIP files by default without any extra software.

If every visitor gets all the same images, you can pre-create the ZIP file and have this for download from your website as a web link.

If you want visitors to pick what images they want and get a customised ZIP containing just the images they are after, you'd need to have a server side program in PHP/Java/.Net etc. that would autom create a temporary ZIP file on your server on the fly and send this ZIP data stream back to the visitor for what they have chosen.

vangogh
02-07-2012, 12:35 PM
I agree. Placing everything in a zip file will likely be easiest. If you need to move files in and out of the zip dynamically you'll need some kind of scripting. Here's info about Zip functions from php.net (http://php.net/manual/en/book.zip.php).

MyITGuy
02-09-2012, 04:55 PM
Heres some reference code to help you get started:
Create a Zip File Using PHP (http://davidwalsh.name/create-zip-php)