From fd7d87e19255ec6be82f2b7767221fcfcad1554f Mon Sep 17 00:00:00 2001 From: Pablo Fierro Date: Sat, 2 Feb 2013 20:43:17 -0600 Subject: [PATCH] Fixed "failed to open stream: No such file or directory" error uploading image/file when $storage dir does not exist throws an error --- anchor/models/extend.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/anchor/models/extend.php b/anchor/models/extend.php index 0e6177b0e..ecb7678d8 100755 --- a/anchor/models/extend.php +++ b/anchor/models/extend.php @@ -137,6 +137,9 @@ public static function files() { public static function upload($file) { $storage = PATH . 'content' . DS; + + if(!is_dir($storage)) mkdir($storage); + $ext = pathinfo($file['name'], PATHINFO_EXTENSION); $filename = hash('crc32', file_get_contents($file['tmp_name'])) . '.' . $ext;