Forums

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.

#183811
TC
Participant

Hey __ I found a suggestion on stackoverflow about using two php scripts to handle multiple download files.

http://stackoverflow.com/questions/4993468/php-header-to-download-multiple-files-in-loop/19972789#19972789

Read the reply that starts with “Step1: Create one index.php file and add following code.” that contains two php scripts.

Could I have my javascript give the filepaths to a middle php script which passes them off to a download php script?

Do you think that would work?

TIA.

Question here:
How can I have a php page automatically send a value to another php page?
I know how to do it when a user clicks a button, but not when the php page loads without any user interaction.

Edit: I think I just figured out I can do this using header. Am not sure if that’s the correct way to do it though.

Is this possible using some kind of hidden form or something or does this require a php socket?

Alternative ideas not sure if they’d work or not :
I suppose I could try to use a session variable.
Javascript page sends file list or just the first file name to php page 1 which sets the session variable to the first filename then executes php page 2 which does the download using the session variable.

Upon completion it contacts either php page 1 for the next file or the javascript page for the next file name to download.

Alternative:
Maybe I could have the javascript send the list of files to download the php page 1 which writes this list to a text file then contacts php page 2 the download page which grabs the file names from the text file.

Which one of any of those multiple file download ideas sounds like it would work and would be the best way?
Am tired now again, it’s late. Need to rest :)
Thanks guys.