How to trigger multiple file downloads with submit php
The code above will fail in IE6 unless the following are added:. Now, the use of Cache-Control is wrong in this case, especially to both values set to zero, according to Microsoft , but it works in IE6 and IE7 and later ignores it so no harm done. If you still get strange results when downloading especially in IE , make sure that the PHP output compression is disabled, as well as any server compression sometimes the server inadvertently applies compression on the output produced by the PHP script.
Historically it had some performance issues and while the documentation claims there are no memory problems, real-life scenarios beg to differ — output buffering and other subtle things. Regardless, if you need byte ranges support, you still have to output the old-fashioned way.
You just output a header and the module takes care of the rest. This is the source of many seemingly obscure errors. If you have output buffering, the file will not be sent to the user in chunks but only at the end of the script. At the start of your script, after checking the file if it exists, etc. Be aware that multiple ranges can be specified e. If the range is not valid, you must output. Do not try to guess or fix the range s as it may result in corrupted downloads, which are more dangerous than failed ones.
Many developers forget to send the code or the Accept-Ranges. Please check out the tutorial on regular expressions to learn the regular expressions in details. Is this website helpful to you? Please give us a like , or share your feedback to help us improve.
Connect with us on Facebook and Twitter for the latest updates. Example Try this code ». Sign up using Email and Password. Post as a guest Name.
Email Required, but never shown. The Overflow Blog. Who owns this outage? Building intelligent escalation chains for modern SRE. Podcast Who is building clouds for the independent developer? Featured on Meta. Now live: A fully responsive profile. Reducing the weight of our footer. Linked 0. Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled. Just a FYI to others reading this: The download attribute won't work for cross-origin requests at least with the latest version of Chrome.
I think it used to but was patched out — georaldc. This is solution that worked for me. Lukasz Dynowski Lukasz Dynowski 7, 4 4 gold badges 53 53 silver badges 83 83 bronze badges. I know that executing code on time intervals basis should be avoidable, but sometimes you gotta do what you gotta do.
I think 10 was the max number of connections configured in your browser. CodeWriter23 might be so. Can you provide any link s where one can set max number of connections in Chrome and Firefox?
Lukasz: not under program control. The best answer I have is Chrome has the limit hardcoded, and Firefox it is in about:config under network. You can either: Zip the selected files and return the one zipped file. Open multiple pop-ups each prompting for a download. Note - option one is objectively better.
Matthew Matthew 9, 4 4 gold badges 41 41 silver badges 75 75 bronze badges. Option 3 it is! This also works on Firefox, and reportedly also on Edge, but I have no interest in testing that myself Edge is migrating to Blink themselves anyway - good riddance. Badasahog 1 1 silver badge 17 17 bronze badges. Zach Painter Zach Painter 1 1 silver badge 8 8 bronze badges. Found the easiest way to do this.
Works even with div! S 41 5 5 bronze badges. This is the easiest way I have found to download multiple files.
Thank You.