Re: download file from an ajax request
| From: | Nitsan Bin-Nun | Date: | Fri, 20 Jun 2008 13:10:49 +0000 |
| Subject: | Re: download file from an ajax request | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-275696@lists.php.net to get a copy of this message | ||
I believe that you don't even have to program it, try to use:
<iframe src='xxx.php'></iframe>
And include download headers on the php file - as far as i remember it
should popup a "save as" dialog.
Regards,
Nitsan
On 20/06/2008, pere roca ristol <peroc79@gmail.com> wrote:
>
> yes Iv, surely this is a more js/Ajax issue... this is the one who has to
> do something with php answer.
> sorry,
>
> Pere
>
> 2008/6/20 Iv Ray <pobox@verysmall.org>:
>
> > Eric Butera wrote:
> >
> >> The only thing I can think of is using JS to create some sort of
> >> IFRAME, meta redirect, window.location, or a popup window, something
> >> that will force the page to hit your download script directly. I've
> >> never attempted it myself so I'm not sure what sort of issues IE would
> >> have with any of the above.
> >>
> >
> > Well, if we, the illiterate, are going to brainstorm ;) - clicking a
> > link/button/image executes JavaScript function, which (via AJAX request)
> > hits the php download script. The response will be received by the AJAX
> > object.
> >
> > Nothing php here.
> >
> > As far as I see the problem, it is - how to pass this response to the
> > browser in an elegant way, so that the browser will open a "Save as..."
> > dialogue and will direct the stream there.
> >
> > One could ask this on a JavaScript/AJAX list.
> >
> > Iv
> >
>