Добрый день, все. Я хочу загрузить несколько файлов изображений в мое ведро S3, я могу это сделать. Единственная проблема, с которой я сталкиваюсь после загрузки файлов в мое ведро AWS S3, состоит в том, что файлы есть, но все файлы изображений имеют размер = 0. Что может вызвать эту проблему? Я использую последнюю версию AWS S3 Php SDK, код ниже примерно продемонстрирует мою попытку: Панель управления Amazon S3
//Get all our files
$allFiles = $_FILES['files'];
//create an array to store all of our commands
$commands = array();
$imgURLArray = array();
$temp_files_array=array();
for($i=0; $i<count($_FILES['files']['name']); $i++)
{
//properties for creating nd placing the temporary file:
$name = $allFiles['name'][$i]; // Get the origanal img name
$tmp_name = $allFiles['tmp_name'][$i]; //get the original temp_name
$extension = explode('.', $name); // get the file extension
$extension = strtolower(end($extension)); //make sure the extension is in lowercase
$randomGeneratedName = md5(uniqid()); // Generate a new unique name for our temp file
$tmp_file_path = "../../tmp_files/{$randomGeneratedName}.{$extension}";
//move our temporary to the temp_folder file
move_uploaded_file($tmp_name, $tmp_file_path);
//Bucket properties
$bucket = $config["buckets"]['mybucket'];
$path = $config["product"]['path'];
$imgName= 'product'. $productID.$i.'.'.$extension;
$body = fopen($tmp_file_path, 'rb');
$acl = 'public-read';
//Command parameters
$objParams =
[
'Bucket' => $bucket,
'Key' => $path.$imgName,
'body' => $body,
'ACL' => $acl
];
$commands[] = $s3Client->getCommand('PutObject', $objParams);
$url = $config['bucket']['url'].$path.$imgName;
array_push($temp_files_array,$tmp_file_path);
array_push($imgURLArray, $url);
}
$pool = new CommandPool($s3Client,$commands);
$promise = $pool->promise();
$promise->wait();