Created
October 23, 2014 07:08
-
-
Save wayanjimmy/d1b16e53122351474cbc to your computer and use it in GitHub Desktop.
Contoh Upload File di Laravel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']); | |
} | |
} |
ini contoh pake Intervention
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
di taruh di modelnya