$response->json($response); } $icon_path = 'storage/icons/'; $icon_path_temp = 'storage/icons/' . $name . '/'; // Uploader init $uploader = new Uploader(); $uploader->setDir($icon_path); $uploader->setExtensions(array('gz', 'zip')); //allowed extensions list// $uploader->setMaxSize(2); //set max file size to be allowed in MB// $uploader->setCustomName($name); $uploader->sameName(true); $uploader->setUniqueFile(); // Upload a file if (!($file = $api->uploadRepackFile('file', $uploader, $icon_path, $icon_path))) { $error = $api->getErrors(); $response->status = 500; $response->message = $error[0]; $response->json($response); } $file_name = strtok($file, '.'); //var_dump($uploader,$icon_path,$icon_path_temp,$file_name); //return; if ($file) { $input = array('user_id' => $user->id, 'name' => Ut::toSlug($file_name), 'title' => $file_name, 'file' => $file, 'author' => trim($user->first_name . ' ' . $user->last_name), 'homepage' => $user->homepage, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")); if (!$model->iconCreate($input)) { $response->status = 500; $response->message = 'Unable to upload a icon set'; $response->json($response); }