我正在尝试上传400MB大小的文件,但它会抛出错误,如“内存不足”。所以我想通过分多个部分发送输入流来上传文件。
我尝试了很多方法,但是没有运气。我想按代码中的多个部分发送请求,但这不起作用。请帮助我解决这个问题。谢谢
sEntityBody = "----boundary" & vbCrLf
sEntityBody = sEntityBody & "Content-Disposition: form-data; name=fileInputElementName; filename=""" + sFileName + """" & vbCrLf
sEntityBody = sEntityBody & "Content-Transfer-Encoding: base64" & vbCrLf
sEntityBody1 = sEntityBody & "Content-Type: application/pdf" & vbCrLf & vbCrLf
sEntityBody1 = sEntityBody & sPDFBase64 & vbCrLf
sEntityBody1 = sEntityBody & "-----boundary--" & vbCrLf & vbCrLf
Set xhr = New MSXML2.XMLHTTP30
xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=-----boundary")
xhr.Open "POST", sUrl, False
xhr.send sEntityBody
xhr.send sEntityBody1
该错误发生在代码的最后一行。可以上传文档,但是内存不足。