your ajax url should be relative to the root : change url:'add-catagory', to url:'/add-catagory',
try using Request class;
public function catadd($request){
if ($request->hasFile('photo')) {
//
}
}
i could be wrong but doesnt your ajax request supposed to be of a different type other than post for file uploads? probably not...
Here is good example of Laravel 5 ajax image upload : http://itsolutionstuff.com/post/ajax-image-upload-example-with-validation-in-php-laravel-frameworkexample.html
I hope it can help you
If you want multiple Image Upload with preview then this link can help you : https://hdtuto.com/article/laravel-5-ajax-multiple-image-upload-with-preview-example
As long as your route and controller are concerned, they are configured right (check your code from this tutorial of laravel file and image upload). So the problem might be with AJAX configuration. Check your AJAX/jQuery file.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community