I am developing an iOS app and I am using node.js
for server side scripting. I am facing problem in uploading image to server from iOS app. It is working fine if I am uploading image from webpage form. But if uploading from app side it is not working.
//test file
h3 Pic Upload
form(action='/pic_upload', method='post',enctype='multipart/form-data')
| user_pic:
input(type='file', name='user_pic')
input(type='submit')
//app.js
var userlogin =require('./routes/userlogin');
app.post('/pic_upload', userlogin.picUpload);
//userlogin.js
//picUpload function
exports.picUpload = function(req, res) {
console.log(req.files); // showing undefined, when called from IOS app
// pic upload script...
});
I have tried sending image from app side as data or file parameter but it did not work. How to send the file parameter from app side so that I can easily upload the image to server? Kindly suggest a way to tackle the problem.