开发者

Download IMG file populated in a PHP file?

开发者 https://www.devze.com 2023-02-28 17:17 出处:网络
I need a simple script that will download a image file to the user\'s computer. However开发者_开发技巧, it is populated in a PHP file like this: mydomain.com/image.php?id=234234 so I can\'t use it in

I need a simple script that will download a image file to the user's computer. However开发者_开发技巧, it is populated in a PHP file like this: mydomain.com/image.php?id=234234 so I can't use it in download scripts that do it like this: downloadfile.php?filename=images/1321.jpg.

What's my best option?

Thanks,

Coulton


I'm guessing you want the download script to send out a real filename so it'll get saved as "1321.jpg" on the user's computer, and not "234234".

That's accomplished via the Content-disposition HTTP Header:

Content-disposition: attachment; filename="234234.jpg"
0

精彩评论

暂无评论...
验证码 换一张
取 消