0

I want to receive the files in a formData and send in an ajax request and I want the server to receive it as if it were an input file field.

I tried this: Add files from Dropzone to form

but when I make the request, my server doesn't recognize it as an input file field

$.ajax({
        url: args.url,
        data: formData, /*I want the file inside this formData */
        success: function(data){
            
        }, error: function() {

        }
    });
Cristiano Felipe
  • 117
  • 1
  • 10
  • Does this answer your question? [jQuery Ajax File Upload](https://stackoverflow.com/questions/2320069/jquery-ajax-file-upload) – Jonathan Dec 18 '20 at 09:00

1 Answers1

0

You can try to add processData : false and contentType : false to your ajax

As below:

$.ajax({
        url: args.url,
        data: formData, /*I want the file inside this formData */
        processData : false,
        contentType : false,
        success: function(data){
            
        }, error: function() {

        }
});
Gerard Haw
  • 86
  • 6