Re: download file from an ajax request
| From: | Daniel Brown | Date: | Fri, 20 Jun 2008 16:59:37 +0000 |
| Subject: | Re: download file from an ajax request | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-275713@lists.php.net to get a copy of this message | ||
On Fri, Jun 20, 2008 at 8:02 AM, pere roca <peroc79@gmail.com> wrote:
>
[snip!]
> imagepng($image,'definitius_hola.png');
Here you call it 'definitius_hola.png'....
> $h = fopen("definitius.png", "r");
> header("Content-Type: image/png");
> header("Content-Disposition: attachment; filename=\"definitius.png");
Whereas here, you call it 'definitius.png', and also forget the
closing escape quote in the filename="" section.
Once you get your download script fixed, try adding these lines to
your page:
<iframe height="0" width="0" name="dl" id="dl"
frameborder="0"></iframe>
<a href="img.php" target="dl">Click to Download</a>
And just replace img.php with the name of your script.
--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.