I am developing an iOS application and I am using node.js for server side scripting. I am facing a problem while uploading an image to the server from an iOS application. It works fine if I load an image from a web page form. But when loading from the application side, it does not work.
//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 tried to send the image from the application side as a data or file parameter, but that did not work. How to send file parameter from application side so that I can easily upload image to server? Please suggest a way to solve the problem.
source share