dougou5852 2015-12-19 05:21
浏览 135

下载时重命名文件,但不适用于AWS S3

I have this code that rename a file name when downloading but is not working for files from AWS S3

code:

 <a href="https://gzfiles.s3.amazonaws.com/1450501725_test1.mp3" download="file.mp3">DOWNLOAD</a>

It works when the href is from another server but not from AWS S3.

  • 写回答

1条回答 默认 最新

  • du31992 2015-12-19 05:39
    关注

    Try setting Content-Disposition header from server side. It will work with all browsers. download attribute is not supported in some browsers like IE.

     <?php
         http_send_content_disposition("file.mp3", true);
         http_send_content_type("audio/mpeg");
         http_throttle(0.1, 2048);
         http_send_file("path/1450501725_test1.mp3");
     ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分