I am trying to make image uploader in Laravel 5, but I am strill getting this error:
MethodNotAllowedHttpException in RouteCollection.php line 219
What can cause this problem?
Form:
<form name="upload_image" method="post" action="">
<input type="file" accept="image/*">
<input type="hidden" name="_token" value="">
<input type="submit" name="submit">
routes.php
Route::post('uploadImage', [
'as' => 'uploadImage',
'uses' => 'HomeController@uploadImage'
]);
HomeController.php
public function uploadImage() {
if (Auth::check()) {
if (Auth::user()->admin == 1) {
$image = Input::get('image');
$filename = time() . '.' . $image->getClientOriginalExtension();
$path = public_path('articleImages/' . $filename);
Image::make($image->getRealPath())->resize(600, 400)->save($path);
return view('admin.uploadImage')->with('path', $path);
}
return view('/');
}
return view('/');
}
Thank you.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/26UpqBB
via IFTTT
Aucun commentaire:
Enregistrer un commentaire