Uploading a file with XMLHttprequest - Missing boundary in multipart/form-data

邮差的信 提交于 2019-11-29 06:54:11

Well this is strange a little bit for me, but this is what worked:

// Open
xhr.open('POST', this.options.action, true);

// !!! REMOVED ALL HEADERS

// Send
xhr.send(formData);

In this case, on server side I don't read the file sent via php://input but the file will be in the $_FILES array.

This solved my problem, but I'm still curious why appears now the file in $_FILES?

Tested in Chrome, Mozilla, Safari, and IE10.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!