0
我是一个初学者离子框架开发。离子本地文件传输 - 文件上传 - 节点js快递服务器,但req.files undefined
这是我的离子应用程序的流程。 - 从文件夹中选择图像,然后按“上传图片”按钮。 - 我使用离子本地文件传输上传到Nodejs express服务器。
这是我的代码。
//离子页 https://www.dropbox.com/s/k1nittp0p8t4ay3/item-create.rar?dl=0
//节点JS源 https://www.dropbox.com/sh/0zd9ydk0uhhz5g7/AABIg9S7hV6XiIzrMTj8FKA2a?dl=0
要点: app.post( '/上传',功能(REQ,RES)),uploadImage()
//ionic3-item.js
uploadImage() //When press upload button
{
const fileTransfer:FileTransferObject = this.transfer.create();
let option: FileUploadOptions = {
fileKey:'file',
fileName:'name.jpg',
mimeType:'image/jpeg'
};
fileTransfer.upload(this.fileurl, encodeURI("http://192.168.1.249:8080/upload"),option);
}
}
//This Node js server code.
//route/ index.js
module.exports = function(app, Article)
{
//Uploaded Article------------------This part -------------------------
app.post('/upload', function(req,res){
console.log(req.files);
});
}
但是req.files未定义。 我不知道如何处理从离子应用程序上传的文件。 请帮忙。
谢谢。
你可以在问题中粘贴你的代码。它使得它更容易阅读和理解 – Malice
感谢您的回复。我粘贴了代码。 – fastworker399