From 39063d783122b6d659715a8b0da997c590071c09 Mon Sep 17 00:00:00 2001 From: Bakr Alsharif Date: Wed, 4 Aug 2021 20:57:32 +0300 Subject: [PATCH] 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. --- 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); }