Amazon S3/Cloadfont 强制下载 zip 文件
使用此脚本生成过期的亚马逊 CloudFont 链接后 http:// aws.amazon.com/code/3514?_encoding=UTF8&jiveRedirect=1/ )。
我想使用 php 强制开始下载。 虽然我以为这很容易,但看起来相当复杂。 并且 http://docs.amazonwebservices.com/AWSSDKforPHP/latest/#i=AmazonS3< /a> 似乎并没有让我真正走得更远。
所有文件都是 .zip 文件。
我希望这里有人可以进一步帮助我。
到目前为止我得到的代码似乎很不正确:
$url = $_POST['url'];
header('Content-Disposition: attachment; filename='.basename($url));
header('Content-Type: application/zip');
readfile($file);
After having generated a expiring amazon CloudFont link by using this script http://aws.amazon.com/code/3514?_encoding=UTF8&jiveRedirect=1/ ).
I would like to force the download to start by using php.
Al tough I thought this would be easy it seem rather complicated.
And http://docs.amazonwebservices.com/AWSSDKforPHP/latest/#i=AmazonS3 doesn't seem to get me really further.
All file are .zip files.
I hope someone here could help me further.
The code I've got so far seems far from right:
$url = $_POST['url'];
header('Content-Disposition: attachment; filename='.basename($url));
header('Content-Type: application/zip');
readfile($file);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我过去必须使用的一些标头,以便通过 https 强制下载在各种浏览器中正常工作,也许它也会对您有所帮助:
然后添加您以前的代码行。
here's some headers i had to use in the past to get force download to work properly in various browser over https, perhaps it'll help you too:
then add your previous code lines.