标题:http post 文件
取消只看楼主
radiofan
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:11
帖 子:466
专家分:696
注 册:2006-7-30
结帖率:76.47%
 问题点数:0 回复次数:0 
http post 文件
Http = CreateObject("MSXML2.XMLHttp")
Http.Open("Post","https://xxx.api",.F.)
Http.setRequestHeader("Content-Type","multipart/form-data;boundary=123456789")

lcpost = '--123456789'+chr(13)+chr(10)
lcpost = lcpost +'Content-Disposition: form-data; name="doc_title"'+chr(13)+chr(10)+chr(13)+chr(10)

lcpost = lcpost +'001'+chr(13)+chr(10)
lcpost = lcpost +'--123456789'+chr(13)+chr(10)
lcpost = lcpost +'Content-Disposition: form-data; name="doc_type"'+chr(13)+chr(10)+chr(13)+chr(10)

lcpost = lcpost +'1'+chr(13)+chr(10)
lcpost = lcpost +'--123456789--'+chr(13)+chr(10)

Http.send(lcpost)
cfhxx = Http.ResponseText

*****************************************************
lcpost = lcpost + lcmsg_digest+CHR(13)+CHR(10)
lcpost = lcpost + '--GF3H7G2YU1JH74GTRF'+CHR(13)+CHR(10)
lcpost = lcpost + 'Content-Disposition: form-data; name="file"; filename="/D:/xxx/合同文件.pdf"'+CHR(13)+CHR(10)
lcpost = lcpost + 'Content-Type: application/pdf'+CHR(13)+CHR(10)+CHR(13)+CHR(10)

lcpost = lcpost + lcfiledata +CHR(13)+CHR(10)
lcpost = lcpost + '--GF3H7G2YU1JH74GTRF--'+CHR(13)+CHR(10)

如果上传文件呢?这里的lcfiledata的编码格式又是什么呢?filetostr('合同文件.pdf')上传成功,但后台是空白pdf文件。 求解?
搜索更多相关主题的帖子: name pdf http 文件 post 
2020-11-05 16:28



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-503783-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019577 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved