Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon s3 将大文件上载到AmazonS3_Amazon S3_Uploadify - Fatal编程技术网

Amazon s3 将大文件上载到AmazonS3

Amazon s3 将大文件上载到AmazonS3,amazon-s3,uploadify,Amazon S3,Uploadify,我已经设法让下面的脚本处理较小的文件。但当我尝试上传10MB或更大的文件时,它会说已经完成了,但文件没有显示在我的S3存储桶中 你知道为什么它会上传更小的文件而不是10MB或更大的文件吗 <?php //System path for our website folder define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR); //URL for our website define('WEBROOT', ht

我已经设法让下面的脚本处理较小的文件。但当我尝试上传10MB或更大的文件时,它会说已经完成了,但文件没有显示在我的S3存储桶中

你知道为什么它会上传更小的文件而不是10MB或更大的文件吗

<?php
//System path for our website folder
define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);
//URL for our website
define('WEBROOT', htmlentities(
    substr($_SERVER['REQUEST_URI'], 0, strcspn($_SERVER['REQUEST_URI'], "\n\r")),
    ENT_QUOTES
));

//Which bucket are we placing our files into
$bucket = 'bucket.mysite.com';
// This will place uploads into the '20100920-234138' folder in the $bucket bucket
$folder = date('Ymd-His').'/'; //Include trailing /

//Include required S3 functions
require_once DOCROOT."includes/s3.php";

//Generate policy and signature
list($policy, $signature) = S3::get_policy_and_signature(array(
    'bucket'        => $bucket,
    'folder'        => $folder,
    ));
?>


<script type="text/javascript">
    $(document).ready(function() {
        $("#file_upload").uploadify({
            'uploader'      : '<?= WEBROOT ?>files/uploadify/uploadify.swf',
            'buttonText'        : 'Browse',
            'cancelImg'     : '<?= WEBROOT ?>files/uploadify/cancel.png',
            'script'        : 'http://s3.amazonaws.com/<?= $bucket ?>',
            'scriptAccess'      : 'always',
            'method'        : 'post',
            'scriptData'        : {
                "AWSAccessKeyId"        : "<?= S3::$AWS_ACCESS_KEY ?>",
                "key"               : "${filename}",
                "acl"               : "authenticated-read",
                "policy"            : "<?= $policy ?>",
                "signature"         : "<?= $signature ?>",
                "success_action_status"     : "201",
                "key"               : encodeURIComponent(encodeURIComponent("<?= $folder ?>${filename}")),
                "fileext"           : encodeURIComponent(encodeURIComponent("")),
                "Filename"          : encodeURIComponent(encodeURIComponent(""))
            },
            'fileExt'       : '*.*',
            'fileDataName'      : 'file',
            'simUploadLimit'    : 2,
            'multi'         : true,
            'auto'          : true,
            'onError'       : function(errorObj, q, f, err) { console.log(err); },
            'onComplete'        : function(event, ID, file, response, data) { console.log(file); }
        });
    });
</script>

$(文档).ready(函数(){
$(“#文件上传”).uploadify({
“uploader”:“files/uploadify/uploadify.swf”,
'buttonText':'Browse',
“cancelImg”:“files/uploadify/cancel.png”,
'脚本':'http://s3.amazonaws.com/',
“scriptAccess”:“始终”,
'method':'post',
“脚本数据”:{
“AWSAccessKeyId”:“,
“键”:“${filename}”,
“acl”:“已验证读取”,
“政策”:“政策”,
“签字”:“,
“成功行动状态”:“201”,
“键”:encodeURIComponent(encodeURIComponent(${filename})),
“fileext”:encodeURIComponent(encodeURIComponent(“”),
“文件名”:encodeURIComponent(encodeURIComponent(“”))
},
“fileExt”:“***”,
'fileDataName':'file',
“simUploadLimit”:2,
"多":对,,
“自动”:正确,
'onError':函数(errorObj,q,f,err){console.log(err);},
“onComplete”:函数(事件、ID、文件、响应、数据){console.log(文件);}
});
});


问题已解决此行的问题

'["content-length-range",0,5242880]'
我把它注释掉了,它按它应该的方式工作。没有大小限制

'["content-length-range",0,5242880]'