dsstlsqt696435 2013-10-07 15:13
浏览 98

S3 Bucket亚马逊问题

1) I have upload form

2) It uploads file to my local storage move_uploaded_file.

3) It uses zend putObject function to move file to s3 object.

Everything works ok till I have file size of around 30Mb to 40 Mb. The problem is when I try uploading larger files like 80 Mb, 100 Mb or so, the file moving to s3 takes ages to complete the upload. My code is something like this:

$orginalPath = APPLICATION_PATH."/../storage/".$fileName;
move_uploaded_file($data['files']['tmp_name'], "$orginalPath");

$s3 = new Zend_Service_Amazon_S3($accessKey, $secretKey);

$s3->putObject($path, file_get_contents($orginalPath),
    array(Zend_Service_Amazon_S3::S3_ACL_HEADER =>Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ));

Can you help how to handle large files move quickly I tried using streamWrapper like this

$s3->registerStreamWrapper("s3");


file_put_contents("s3://my-bucket-name/orginal/$fileName", file_get_contents($orginalPath));

But no luck, it take same long time to move file.

Hence, is there an efficient way to move file quickly to s3 bucket?

  • 写回答

2条回答 默认 最新

  • dounie5475 2013-10-07 16:45
    关注

    You could consider using the more direct POST to S3 feature. The AWS SDK for PHP has a class to help generate the data for the form.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于单片机数字电压表电路组成及框图
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line