let urlPath = "/uploadFile"
var saveDir = plus.io.convertLocalFileSystemURL('_downloads'); // 文件保存目录
httpServer.uploadFile(urlPath, saveDir, (request) => {
console.log("uploadFile request:" + JSON.stringify(request))
console.log("上传文件保存目录:" + saveDir)
this.sendJSONResponse(request)
// ios:
// {"remoteAddress":"172.16.11.60:59430","body":{"age":{"isFile":false,"value":"20"},"name":{"isFile":false,"value":"wrs"},"file":{"fileName":"text.txt","isFile":true,"path":"/var/mobile/Containers/Data/Application/0365A8A9-B926-4571-9C4D-C251DC7AAB26/Library/Caches/Pandora/downloads/text.txt"}},"urlParams":{},"url":"http://172.16.11.44:8888/uploadFile","localAddress":"172.16.11.44:8888","method":"POST","headers":{"User-Agent":"PostmanRuntime/7.32.3","Accept":"*/*","Content-Length":"651","Content-Type":"multipart/form-data; boundary=--------------------------445338919225193221741331","Host":"172.16.11.44:8888","Postman-Token":"d1501ccd-0e2e-407d-89ad-6604f3e3b76f","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive"},"path":"/uploadFile"}
}, () => {
// 添加uploadFile完成
});
我用这个接收上传文件,然后我用JS+html写一个上传的HTML文件,上传不上来,没有任何提示
1 个回复
8***@qq.com
有问题可以加QQ252797991咨询