diff --git a/common/framework/HTTP.php b/common/framework/HTTP.php index 5f38d3cb6..d0d39304d 100644 --- a/common/framework/HTTP.php +++ b/common/framework/HTTP.php @@ -91,7 +91,11 @@ class HTTP $target_dir = dirname($target_filename); if (!Storage::isDirectory($target_dir) && !Storage::createDirectory($target_dir)) { - return false; + return new Helpers\HTTPHelper(new Exception('Cannot create directory: ' . $target_dir)); + } + if (!Storage::isWritable($target_dir) && (!Storage::exists($target_filename) || !Storage::isWritable($target_filename))) + { + return new Helpers\HTTPHelper(new Exception('No permission to write file: ' . $target_filename)); } // Pass to request() with appropriate settings for the filename.