I am a beginner at ionic framework developing.
This is flow of my ionic app. - Select image from folders and press "upload a picture" button. - I used ionic-native-file transfer for uploading to Nodejs express server.
This is my code.
//ionic page https://www.dropbox.com/s/k1nittp0p8t4ay3/item-create.rar?dl=0
//Node js source https://www.dropbox.com/sh/0zd9ydk0uhhz5g7/AABIg9S7hV6XiIzrMTj8FKA2a?dl=0
Main Point: app.post('/upload', function(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);
});
}
But req.files is undefined. I wonder how I can treat the uploaded files from ionic app. Please help.
Thanks.