How to set boundary while using XmlHttpRequest and FormData

后端 未结 2 1660
北海茫月
北海茫月 2021-02-06 00:04

I am trying to set the boundary correctly in the header while using FormData to post the XmlHttpRequest:

xhr.open(\"POST\",url);
xhr.setRequestHeader(\"Content-t         


        
2条回答
  •  孤街浪徒
    2021-02-06 00:57

    Try looking at this, How to send multipart/form-data form content by ajax (no jquery)? I am trying to work with this script with PHP as the reciever, having some problems with mixed results of warnings and I think my problem is that I have hacked away at the scripts both ends too much that its no longer functioning.

    As for the comment by the other poster "If you're using JQuery", the only thing I have to say to that comment is that it is not helpful to the person not working in JQuery and JQ is not the be all and end all of scripts.

提交回复
热议问题