public function up() { $url = Env::get('root_path').config('diydb.mypublic'); $storage = new \Upload\Storage\FileSystem($url); $file = new \Upload\File('foo', $storage); dump($file);// Optionally you can rename the file on upload $new_filename = uniqid(); $YMD = date("Y-m-d",\time()); $file->setName($YMD);// Validate file upload// MimeType List => http://www.iana.org/assignments/media-types/media-types.xhtml $file->addValidations(array( // Ensure file is of type "image/png" new \Upload\Validation\Mimetype(['image/png','image/gif','image/jpg','image/jpeg']), //You can also add multi mimetype validation //new \Upload\Validation\Mimetype(array('image/png', 'image/gif')) // Ensure file is no larger than 5M (use "B", "K", M", or "G") new \Upload\Validation\Size('10M') ));// Access data about the file that has been uploaded $data = [ 'name' => $file->getNameWithExtension(), 'extension' => $file->getExtension(), 'mime' => $file->getMimetype(), 'size' => $file->getSize(), 'md5' => $file->getMd5(), 'dimensions' => $file->getDimensions() ];// Try to upload file try { // Success! $d = $file->upload(); dump($d); } catch (\Exception $e) { // Fail! $errors = $file->getErrors(); dump($data); } }