I am using the official PHP SDK with the official service provider for laravel to upload an image to Amazon S3. The image is temporarily stored on my server and should be de
When you're using SourceFile option at putObject S3Client opens a file, but doesn't close it after operation.
In most cases you just can unset $client and/or $result to close opened files.
But unfortunately not in this case.
Use Body option instead of the SourceFile.
// temp file
$file = fopen($temp_path, "r");
// use resource, not a path
$result = $client->putObject(array(
'Bucket' => self::$bucketName,
'Key' => 'screenshot/testing.png',
'Body' => $file,
'ACL' => 'public-read'
));
);
fclose($file);
unlink($temp_path);