Uploading files via jQuery, object FormData is provided and no file name, GET request

后端 未结 4 2040
慢半拍i
慢半拍i 2021-01-13 01:27

I am using a jQuery script to upload files to a new page. It somehow works too, but the issue is that it sends the form data as object FormData.

Here i

4条回答
  •  孤城傲影
    2021-01-13 02:10

    you should only submit the file - not the complete form

    var fileInput = $('#image');
    var file = fileInput.files[0];
    var formData = new FormData();
    formData.append('file', file);
    

    EDIT

    
    
    

提交回复
热议问题