double2022 2012-07-06 15:40
浏览 29
已采纳

将图像上传到亚马逊s3

I am uploading images to amazons3 bucket, but its taking like 2 minutes execution for 10 images but I have to upload 10GB of images, I should receive the update for the each image update make sure its working....

  while($file=readdir($handle)):
            if(is_file($file)){
                $extn = explode('.',$file);
                $extn = array_pop($extn);
                if (in_array(strtolower($extn),$includedExtn)) {
                    set_time_limit(0);
                    if ($s3->putObjectFile($file, $bucketName, baseName($file), S3::ACL_PUBLIC_READ)) {
                        echo "<br/>";
                        echo "S3::putObjectFile(): File copied to {$bucketName}/".baseName($file);
                    } else {
                        echo "S3::putObjectFile(): Failed to copy file
";
                    }
                }
            } else {
                echo "No more files left";
            }
    endwhile;
  • 写回答

1条回答 默认 最新

  • doupixian1436 2012-07-06 15:46
    关注

    It looks like you're using pretty-much the same code I use. Mine has the same issue of speed though I got faster results by running the same script concurrently (several times in parallel), it seems each put may be limited, but there are no restriction on the number of concurrent PUTs (or if there is I haven't found it yet). I generally run the script 6 times each from the command-line.

    You just need to write your code to ensure it doesn't upload the same file more than once or you'll incur multiple charges for each file (so add something like segmentation to your data-source). I include it in several scripts each which specifies a unique sector it should access from the database.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办