Allow uploading files from URL (#56)

When uploading files from a URL, and if the server closes the connection directly after sending the file, then the resource will be invalid and an exception will be thrown when trying to close it. The supposed fix is to check if the resource is valid.
This commit is contained in:
Bakr Alsharif 2021-08-04 20:57:32 +03:00 committed by GitHub
parent 1e94b00b13
commit 39063d7831
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,7 +168,7 @@ class Space {
$content = fopen($filePath, "r");
$result = $this->s3->upload($this->name, $saveAs, $content, $privacy);
fclose($content);
if(is_resource($content)) { fclose($content); }
return SpacesResult($result);
}