Using FormData object, the server receives an empty POST

前端 未结 1 595
悲哀的现实
悲哀的现实 2021-01-15 15:48

I\'m attempting to send one file and one text variable to my server with the FormData object. Looking at the Network tab in Chrome\'s developer tools, I can see that the fil

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-15 16:35

    Remove the ajaxHandler.setRequestHeader("Content-type","multipart/form-data"); from the code. The proper multipart/form-data header should contain boundary string. Browser automatically set that header, if you add file in FormData.

    0 讨论(0)
提交回复
热议问题