1,451
社区成员
发帖
与我相关
我的任务
分享
'设置要发送的内容
SentInfo=""
SentInfo = SentInfo & "-----------------------------7d82711db0bfc" & vbCrLf
SentInfo = SentInfo & "Content-Disposition: form-data; name=" & Chr(34) & "UpFile" & Chr(34) & "; filename=" & Chr(34) & "C:\a.txt" & Chr(34) & "" & vbCrLf
SentInfo = SentInfo & "Content-Type: text/plain" & vbCrLf
SentInfo = SentInfo & "" & vbCrLf
SentInfo = SentInfo & "这时a.txt的文件内容,因为是文本,所以字节内容也能看见" & vbCrLf
SentInfo = SentInfo & "-----------------------------7d82711db0bfc--" & vbCrLf
Set xmlHTTP1 = CreateObject("Microsoft.XMLHTTP") '你这里是创建XMLHTTP对象
xmlHTTP1.Open "POST", Url, False '这里是指定用POST方法提交请求
xmlHTTP1.setRequestHeader "Content-Type", "multipart/form-data; boundary=---------------------------7d82711db0bfc" '这里设置HTTP头中 Content-Type 的内容
xmlHTTP1.Send StrConv(SentInfo,vbFromUnicode) '将文本转换为字节数组来发送