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