From 7e23a96a6a3dea06906ca42f931695eef5c2671d Mon Sep 17 00:00:00 2001 From: Bakr Alsharif Date: Fri, 18 Dec 2020 19:33:08 +0300 Subject: [PATCH] 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. --- spaces.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spaces.php b/spaces.php index f94358d..d7e83e8 100644 --- a/spaces.php +++ b/spaces.php @@ -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); }