Multiple File Downloads

This is a discussion on Multiple File Downloads within the PHP General forums, part of the PHP Programming Forums category; I've used Richard Lynch's Blog example for forcing the download of an individual file. Is there a way ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-14-2007
David Giragosian
 
Posts: n/a
Default Multiple File Downloads

I've used Richard Lynch's Blog example for forcing the download of an
individual file.

Is there a way to download multiple files in one go, short of zipping them
first into a single file?

Concepts / directional shoves appreciated.

David

Reply With Quote
  #2 (permalink)  
Old 12-14-2007
Daniel Brown
 
Posts: n/a
Default Re: [PHP] Multiple File Downloads

On Dec 14, 2007 3:32 PM, David Giragosian <dgiragosian@gmail.com> wrote:
> I've used Richard Lynch's Blog example for forcing the download of an
> individual file.
>
> Is there a way to download multiple files in one go, short of zipping them
> first into a single file?
>
> Concepts / directional shoves appreciated.


I wouldn't think so, Dave, because headers for each file need to
be sent at the request for download, and headers cannot be sent after
the header buffer has ended (when the data buffer is being sent).

--
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.
Reply With Quote
  #3 (permalink)  
Old 12-14-2007
Jason Pruim
 
Posts: n/a
Default Re: [PHP] Multiple File Downloads


On Dec 14, 2007, at 3:37 PM, Daniel Brown wrote:

> On Dec 14, 2007 3:32 PM, David Giragosian <dgiragosian@gmail.com>
> wrote:
>> I've used Richard Lynch's Blog example for forcing the download of an
>> individual file.
>>
>> Is there a way to download multiple files in one go, short of
>> zipping them
>> first into a single file?
>>
>> Concepts / directional shoves appreciated.

>
> I wouldn't think so, Dave, because headers for each file need to
> be sent at the request for download, and headers cannot be sent after
> the header buffer has ended (when the data buffer is being sent).



I may be showing my ignorance of what can be done... But couldn't you
write a script in PHP (Or some other language) that would link to a
bunch of files and send each one individually to the browser as a
separate file? something like:

<PHP

$filesArray(file1, file2, file3);
foreach($filesArray)
$header ="Blah blah balh"
$header .="More blah blah blah"

Or am I way off base as usual? :)


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
japruim@raoset.com
Reply With Quote
  #4 (permalink)  
Old 12-14-2007
David Giragosian
 
Posts: n/a
Default Re: [PHP] Multiple File Downloads

On 12/14/07, Jason Pruim <japruim@raoset.com> wrote:
>
>
> On Dec 14, 2007, at 3:37 PM, Daniel Brown wrote:
>
> > On Dec 14, 2007 3:32 PM, David Giragosian <dgiragosian@gmail.com>
> > wrote:
> >> I've used Richard Lynch's Blog example for forcing the download of an
> >> individual file.
> >>
> >> Is there a way to download multiple files in one go, short of
> >> zipping them
> >> first into a single file?
> >>
> >> Concepts / directional shoves appreciated.

> >
> > I wouldn't think so, Dave, because headers for each file need to
> > be sent at the request for download, and headers cannot be sent after
> > the header buffer has ended (when the data buffer is being sent).

>
>
> I may be showing my ignorance of what can be done... But couldn't you
> write a script in PHP (Or some other language) that would link to a
> bunch of files and send each one individually to the browser as a
> separate file? something like:
>
> <PHP
>
> $filesArray(file1, file2, file3);
> foreach($filesArray)
> $header ="Blah blah balh"
> $header .="More blah blah blah"
>
> Or am I way off base as usual? :)
>
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424
> www.raoset.com
> japruim@raoset.com



My original thought was as Daniel suggested, but I had a similar cognitive
storm, Jason, and I gave it a try.

I didn't get any headers already sent error messages, but only the last file
in the array was downloaded.

David

Reply With Quote
  #5 (permalink)  
Old 12-14-2007
Andrew Ballard
 
Posts: n/a
Default Re: [PHP] Multiple File Downloads

On Dec 14, 2007 3:49 PM, David Giragosian <dgiragosian@gmail.com> wrote:
>
> On 12/14/07, Jason Pruim <japruim@raoset.com> wrote:
> >
> >
> > On Dec 14, 2007, at 3:37 PM, Daniel Brown wrote:
> >
> > > On Dec 14, 2007 3:32 PM, David Giragosian <dgiragosian@gmail.com>
> > > wrote:
> > >> I've used Richard Lynch's Blog example for forcing the download of an
> > >> individual file.
> > >>
> > >> Is there a way to download multiple files in one go, short of
> > >> zipping them
> > >> first into a single file?
> > >>
> > >> Concepts / directional shoves appreciated.
> > >
> > > I wouldn't think so, Dave, because headers for each file need to
> > > be sent at the request for download, and headers cannot be sent after
> > > the header buffer has ended (when the data buffer is being sent).

> >
> >
> > I may be showing my ignorance of what can be done... But couldn't you
> > write a script in PHP (Or some other language) that would link to a
> > bunch of files and send each one individually to the browser as a
> > separate file? something like:
> >
> > <PHP
> >
> > $filesArray(file1, file2, file3);
> > foreach($filesArray)
> > $header ="Blah blah balh"
> > $header .="More blah blah blah"
> >
> > Or am I way off base as usual? :)
> >
> >
> > --
> >
> > Jason Pruim
> > Raoset Inc.
> > Technology Manager
> > MQC Specialist
> > 3251 132nd ave
> > Holland, MI, 49424
> > www.raoset.com
> > japruim@raoset.com

>
>
> My original thought was as Daniel suggested, but I had a similar cognitive
> storm, Jason, and I gave it a try.
>
> I didn't get any headers already sent error messages, but only the last file
> in the array was downloaded.
>
> David
>


I didn't think such a thing could be possible because the *browser* is
not expecting it. (I was not aware of anything in http that defined a
method for multiple files in the response the same way you can send
multiple parts in a request or in a multipart mail message. I figured
in any case you would get at most one file (if not an error), and that
that file would contain either A) only the contents of the first or
last file pushed to the client or B) the contents of all the files,
munged together in one chunk.

However, your message prompted me to find this on Google. (It's ASP,
but should be easily converted).

http://www.motobit.com/tips/detpg_mu...s-one-request/

I haven't tried it, so I can't really say if it works, but it's the
only way I could expect it to work.

Andrew
Reply With Quote
  #6 (permalink)  
Old 12-14-2007
Daniel Brown
 
Posts: n/a
Default Re: [PHP] Multiple File Downloads

On Dec 14, 2007 3:32 PM, David Giragosian <dgiragosian@gmail.com> wrote:
> I've used Richard Lynch's Blog example for forcing the download of an
> individual file.
>
> Is there a way to download multiple files in one go, short of zipping them
> first into a single file?
>
> Concepts / directional shoves appreciated.


You could use AJAX, JavaScript, or AJAX to make multiple requests
to download various files simultaneously. That would pop up the
different boxes.

--
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.
Reply With Quote
  #7 (permalink)  
Old 12-14-2007
Daniel Brown
 
Posts: n/a
Default Re: [PHP] Multiple File Downloads

On Dec 14, 2007 4:24 PM, Daniel Brown <parasane@gmail.com> wrote:
> On Dec 14, 2007 3:32 PM, David Giragosian <dgiragosian@gmail.com> wrote:
>
> > I've used Richard Lynch's Blog example for forcing the download of an
> > individual file.
> >
> > Is there a way to download multiple files in one go, short of zipping them
> > first into a single file?
> >
> > Concepts / directional shoves appreciated.

>
> You could use AJAX, JavaScript, or AJAX to make multiple requests
> to download various files simultaneously. That would pop up the
> different boxes.


TFGIF. That should read ".... AJAX, JavaScript, or IFRAMEs...."

--
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.
Reply With Quote
  #8 (permalink)  
Old 12-14-2007
David Giragosian
 
Posts: n/a
Default Re: [PHP] Multiple File Downloads

On 12/14/07, Daniel Brown <parasane@gmail.com> wrote:
>
> On Dec 14, 2007 4:24 PM, Daniel Brown <parasane@gmail.com> wrote:
> > On Dec 14, 2007 3:32 PM, David Giragosian <dgiragosian@gmail.com> wrote:
> >
> > > I've used Richard Lynch's Blog example for forcing the download of an
> > > individual file.
> > >
> > > Is there a way to download multiple files in one go, short of zipping

> them
> > > first into a single file?
> > >
> > > Concepts / directional shoves appreciated.

> >
> > You could use AJAX, JavaScript, or AJAX to make multiple requests
> > to download various files simultaneously. That would pop up the
> > different boxes.

>
> TFGIF. That should read ".... AJAX, JavaScript, or IFRAMEs...."
>
> --
> Daniel P. Brown
> [Phone Numbers Go Here!]
> [They're Hidden From View!]
>
> If at first you don't succeed, stick to what you know best so that you
> can make enough money to pay someone else to do it for you.
>



> TFGIF


Indeed, Daniel. ;-}

Thanks for the link, Andrew. I saw it earlier myself but didn't look too
closely at it because I don't know ASP at all. Does anyone understand how
the files will be sent to the client? Are they going to end up as links on a
web page?

David

Reply With Quote
  #9 (permalink)  
Old 12-14-2007
Robert Cummings
 
Posts: n/a
Default Re: [PHP] Multiple File Downloads

On Fri, 2007-12-14 at 16:24 -0500, Daniel Brown wrote:
> On Dec 14, 2007 4:24 PM, Daniel Brown <parasane@gmail.com> wrote:
> > On Dec 14, 2007 3:32 PM, David Giragosian <dgiragosian@gmail.com> wrote:
> >
> > > I've used Richard Lynch's Blog example for forcing the download of an
> > > individual file.
> > >
> > > Is there a way to download multiple files in one go, short of zipping them
> > > first into a single file?
> > >
> > > Concepts / directional shoves appreciated.

> >
> > You could use AJAX, JavaScript, or AJAX to make multiple requests
> > to download various files simultaneously. That would pop up the
> > different boxes.

>
> TFGIF. That should read ".... AJAX, JavaScript, or IFRAMEs...."


But, but, but I WANNA USE AJAX AGAIN!!!

:)

Have a great weekend everyone.

Cheers,
Rob.
--
.................................................. ..........
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
.................................................. ..........
Reply With Quote
  #10 (permalink)  
Old 12-14-2007
Daniel Brown
 
Posts: n/a
Default Re: [PHP] Multiple File Downloads

On Dec 14, 2007 4:38 PM, Robert Cummings <robert@interjinn.com> wrote:
> On Fri, 2007-12-14 at 16:24 -0500, Daniel Brown wrote:
> > > You could use AJAX, JavaScript, or AJAX to make multiple requests
> > > to download various files simultaneously. That would pop up the
> > > different boxes.

> >
> > TFGIF. That should read ".... AJAX, JavaScript, or IFRAMEs...."

>
> But, but, but I WANNA USE AJAX AGAIN!!!
>
> :)
>
> Have a great weekend everyone.


You, too, Rob. And to all else, make that seconded by me.

Report back here Monday for another week of droning.

--
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:20 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0