Get file errors after upload Hi I have a plugin which is basically a form. This form has upload file field which I added in the backend side in Assets fields so I have something like this:

                &lt;fieldset&gt;
                    &lt;div class="file-upload btn btn-primary"&gt;
                        &lt;span&gt;Upload File&lt;/span&gt;
                        &lt;input type="file" name="fields[myAssetNameHandle]"&gt;
                    &lt;/div&gt;              
                &lt;/fieldset&gt;


I send the form to the server with ajax like this:

    var formData = new FormData($form[0]);
    $.ajax({
        type: 'POST',
        dataType: 'json',
        url: '{{ actionUrl("myplugin/sendApplication") }}',
        data: formData,
        processData: false,
        contentType: false,
    ......


On the myPluginController I have validation

    $model = new myModel();
    $model-&gt;test_var = craft()-&gt;request-&gt;getPost('test_var');

    if ( $model-&gt;validate() ) {

    }else{

    }


Evrithing works fine except that I did some restriction to upload files on that asset field for example only documents so when I upload an image I do not have any errors. So how can I get the errors for that field and if there are no erorrs how can I get the name so After validation to add the file into the db? Thank you in advance and sorry for my English if is not so good.
You can get the errors from the model by using $model-&gt;getErrors().  That will return an array of errors indexed by the attribute name.

Since you submitted over AJAX, you'll want to use $this-&gt;returnErrorJson() to return them and have your JavaScript parse the errors out to display them to the user.