Home > Net >  Target class controller does not exist - laravel 7
Target class controller does not exist - laravel 7

Time:03-04

My Ajax:

$('#upload').change(function () {
    const form = new FormData();
    form.append('file', $(this)[0].files[0]);
    var url = '/admin/upload/services';

    $.ajax({
        processData: false,
        contentType: false,
        type: 'POST',
        dataType: 'JSON',
        data: form,
        url: url,
        success: function (result) {
            console.log(result);
        },
        error: function(){
            alert('error!');
          }
    });
});

My Route: My Route

My Controller: My Controller

My UploadService: My UploadService

My error: My error

CodePudding user response:

"message": Target class controller [App\\Http\\Controllers\\UploadController] does not exist.",

It appears Laravel is failing to find your Controller. Try clearing complied files and let composer try to auto-discover relevant classes.

In your terminal run these two commands one after the other.

php artisan clear-compiled 
composer dump-autoload
  • Related