Skip to content

Instantly share code, notes, and snippets.

@wayanjimmy
Created October 23, 2014 07:08
Show Gist options
  • Save wayanjimmy/d1b16e53122351474cbc to your computer and use it in GitHub Desktop.
Save wayanjimmy/d1b16e53122351474cbc to your computer and use it in GitHub Desktop.
Contoh Upload File di Laravel
public function uploadLogo() {
$file = Input::file('logo');
$destinationPath = Lingkungan::$logoPath;
$filename = $file->getClientOriginalName();
$img = Image::make($file->getRealPath())->resize(150, 150)->save(public_path().$destinationPath.$filename);
if($img) {
return Response::json(['type' => 'success', 'full_filename' => asset($destinationPath.$filename), 'filename' => $filename]);
}else{
return Response::json(['type' => 'error', 'msg' => 'Upload gambar sukses']);
}
}
@wayanjimmy
Copy link
Author

ini contoh pake Intervention

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment