Skip to content

Instantly share code, notes, and snippets.

@Tjoosten
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tjoosten/6bd491ada94bb5313849 to your computer and use it in GitHub Desktop.
Save Tjoosten/6bd491ada94bb5313849 to your computer and use it in GitHub Desktop.
image upload laravel
$file = Input::file('file');
$destinationPath = 'uploads';
// If the uploads fail due to file system, you can try doing public_path().'/uploads'
$filename = str_random(12);
//$filename = $file->getClientOriginalName();
//$extension =$file->getClientOriginalExtension();
$upload_success = Input::file('file')->move($destinationPath, $filename);
if( $upload_success ) {
return Response::json('success', 200);
} else {
return Response::json('error', 400);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment