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

后端 未结 4 2073
慢半拍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:09

    Files cannot be uploaded with the GET method. You need to use POST.

    $.ajax({
       method: 'POST',
       url: '/test/file_capture',
       // ...
    

    Also, you need HTML 5 to be able to upload files (though Firefox might allow it with earlier XHTML).

提交回复
热议问题