Allow uploading files from URL

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 2020-12-18 19:33:08 +03:00 committed by GitHub
parent 28fbd13ef6
commit 7e23a96a6a
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"); $content = fopen($filePath, "r");
$result = $this->s3->upload($this->name, $saveAs, $content, $privacy); $result = $this->s3->upload($this->name, $saveAs, $content, $privacy);
fclose($content); if(is_resource($content)) { fclose($content); }
return SpacesResult($result); return SpacesResult($result);
} }