The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End php download multiple files problem. Reply To: php download multiple files problem.


What appears to be going wrong is the file is being sent back to the javascript instead of being downloaded.

Okay, I must have been half-asleep when I looked at your script last night. This is the issue we were talking about earlier: AJAX requests can’t handle file downloads (at least, they can’t save them to the user’s computer).

When we were talking about using ajax, it was only to provide the list of filenames so the PHP script could zip them together and return the name of the zip file that should be downloaded. The actual downloading needs to be handled by the browser, and that means iframe or new window.

Do your scripts actually work?

Yes. They’re just examples, but I did test them and I’ve used similar scripts in the past.