0
我試圖創建將照片上傳到一個MongoDB的服務器的應用程序,在這裏財產「文件」是我的代碼:的PhoneGap上傳照片:無法讀取的不確定
upload = function (imageURI) {
var ft = new FileTransfer(),
options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = 'filename.jpg'; Node at the server side.
options.mimeType = "image/jpeg";
options.chunkedMode = false;
options.params = {
"description": "Uploaded from my phone"
};
// alert(imageURI);
// alert(serverURL);
ft.upload(imageURI, serverURL + "/images",
function (e) {
getFeed();
},
function (e) {
alert("Upload failed");
}, options);
}
和節點服務器上方這是在錯誤似乎發生:
exports.addImage = function(req, res, next) {
var file = req.files.file,
filePath = file.path,
lastIndex = filePath.lastIndexOf("/"),
tmpFileName = filePath.substr(lastIndex + 1),
image = req.body,
images = db.collection('images');
image.fileName = tmpFileName;
console.log(tmpFileName);
images.insert(image, function (err, result) {
if (err) {
console.log(err);
return next(err);
}
res.json(image);
});
};
所以我有錯誤無法讀取的不確定
什麼是「在服務器端節點。」 ? – dandavis 2014-09-30 22:02:11
只是添加了服務器端代碼 – 2014-09-30 22:09:50