Skip to content

Instantly share code, notes, and snippets.

@antonybudianto
Created June 8, 2015 10:27
Show Gist options
  • Save antonybudianto/82c1c6e3f30a7fed65ee to your computer and use it in GitHub Desktop.
Save antonybudianto/82c1c6e3f30a7fed65ee to your computer and use it in GitHub Desktop.
Upload
if($request->hasFile('image'))
{
$file = $request->file('image');
$fileName = 'IMGP'.date('YmdHis').rand(1,100).'.'.$file->getClientOriginalExtension();
$file->move('img/post', $fileName);
$data['image'] = $fileName;
}
else
{
return redirect(route('admin.post').'/create')->withErrors(['Please choose the image to upload']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment