/** * * Move Uploaded File * * It enclose functions to check if file is from a POST or GET and * have a few more saftey measures. * * ALL FILES WILL BE UPLOADED TO RAW Location * * @param String $tempLocation Location of Uploaded file * @param String $name for File */ public static function upload($tempLocation, $name) { // If no Location is specified return false if (!$tempLocation || !$name) { return false; } // If to Directory is writable if (!is_writable(RAWMEDIAPATH)) { return false; } //If AWS config exist try to move to S3 if (Config::get('s3/key') && Config::get('s3/secret')) { $temp = sys_get_temp_dir() . '/'; move_uploaded_file($tempLocation, $temp . $name); if (Filemanager::MoveToS3($temp . $name, 'rawfile/' . $name, 1)) { unlink($temp . $name); return true; } } // Move File if (move_uploaded_file($tempLocation, RAWMEDIAPATH . $name)) { return true; } }