Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Download multiple file...

Status
Not open for further replies.

skiflyer

Programmer
Joined
Sep 24, 2002
Messages
2,213
Location
US
I have a page, for which I want to put multiple ID's in the $_GET string, and have the file which corresponds to the ID download.

Works great for one file, use the right headers, and fpassthru, but I'm not sure how to do this for many files outside of zipping them up together and sending one zip.

I thought maybe send the file and then write out a window.location touch of javascript, but since my content-type is an octet-stream, this is a no go... is there something else I'm not thinking of that someone out here knows?

Thanks,
Rob
 
under regular dl, the os asks where to store each file...best to zip 'em and that also reduces the dl time

Bastien

Any one have a techie job in Toronto, I need to work...being laid off sucks!
 
Yeah, I understand, I want it to ask where to store each file.

-Rob
 
Am I actually getting to a "sorry, can't do that with PHP" question?

I realize the zip issue is more elegant, but for this particular issue I'm at least wanting to go as far down the other route as possible... is there at least someway I can use PHP to figure out when the download finishes and do something useful, like reload the page with another file...? As it stands, since the content type is an app-octet, I can't exactly send javascript reloads, and I obviouslly can't send a header location... is there another way I'm not thinking of?
 
Again, the "page" in question will be a single file. The file will have a content-type of "application/octet-stream" or something. There is no way to have the page reload, as the browser must initiate the reload, and there is no way to have the browser do that. Even if you could initiate the streaming of the next file from PHP, there is no way to prepare the browser for reception of the file.

This isn't a PHP limitation, it's a limitation of HTTP and HTML. You can have only one reply stream.

Zip the files.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Yeah, I figured that HTTP limitation was goin to bite me, but promised the higher ups I'd research it as much as possible, so I gave it a couple goes, then posted here.

Still have one last idea I'll try, fairly certain it will work, though it'll be ugly... I'll let you know if it pans out.

-Rob
 
You could, I suppose, do something really nasty like use the IDs input to write a PHP-generated JavaScript page that opens multiple browser windows simultaneously, each downloading a different file.

But you run the very real risk of greatly pissing off your users. At least those that aren't running pop-up blockers.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Yeah, that's what I'm thinking. But this is a very specialized application, and only about 3 users have any interest in this particular button, and this is their request, so I'm not so worried about pissing them off.

 
It's going to be ugly, ungainly, unwieldy, unfriendly, and probably loathed the first time it's used.

I don't thing your users realize that to do this, 5 browser windows are going to automatically pop open, and each window is going to spawn a "Save as..." dialog.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top