我正在试着上传一个文件到我的存储桶中。我可以上传Body,但不能上传SourceFile。下面是我的方法:
$pathToFile='/explicit/path/to/file.jpg'
// Upload an object by streaming the contents of a file
$result = $s3Client->putObject(array(
'Bucket' => $bucket,
'Key' => 'test.jpg',
'SourceFile' => $pathToFile,
'ACL' => 'public-read',
'ContentType' => 'image/jpeg'
));但是我得到了这个错误:
You must specify a non-null value for the Body or SourceFile parameters.我尝试过不同类型的文件,但一直收到这个错误。
发布于 2014-12-06 03:03:25
这个问题与没有给出一条好的路径有关。看起来file_exists()只在本地检查,这意味着它必须在本地主机的索引内。
发布于 2016-11-16 21:06:51
变化
'SourceFile' => $pathToFile,至
'Body' => $pathToFile,https://stackoverflow.com/questions/27321593
复制相似问题