Skip to content

Instantly share code, notes, and snippets.

@flayder
Created November 27, 2017 13:15
Show Gist options
  • Save flayder/a3ceb1a144887e7e6bf4ede8730c8b3f to your computer and use it in GitHub Desktop.
Save flayder/a3ceb1a144887e7e6bf4ede8730c8b3f to your computer and use it in GitHub Desktop.
class UploadFileController extends Controller {
public function index() {
return view('uploadfile') ;
}
public function showUploadFile(Request $request) {
$file = $request->file('image') ;
//Display File Name
echo 'File Name: '.$file->getClientOriginalName() ;
echo '<br>';
//Display File Extension
echo 'File Extension: '.$file->getClientOriginalExtension() ;
echo '<br>';
//Display File Real Path
echo 'File Real Path: '.$file->getRealPath() ;
echo '<br>';
//Display File Size
echo 'File Size: '.$file->getSize() ;
echo '<br>';
//Display File Mime Type
echo 'File Mime Type: '.$file->getMimeType() ;
//Move Uploaded File
$destinationPath = 'uploads';
$file->move($destinationPath,$file->getClientOriginalName() );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment