I have the following script that is supposed to receive uploaded images/videos and save them to disk. The script works for images up to 1.5Mb, above that size the file upload shows 0 bytes. There is lots of free space on the volume I'm saving to so free space is not an issue.
I'm making the request using SoapUI with a Media Type of image/jpeg.
http://127.0.0.1:8080/api/uploadfile/Test/cake.jpg
Why would smaller files work but larger files fail?
var restify = require('restify');
var fs = require('fs');
function uploadFile(req, res, next) {
var path = req.params.devicename;
var filename = req.params.filename;
console.log("Upload file");
var writeStream = fs.createWriteStream(path + "/" + filename);
var r = req.pipe(writeStream);
r.on("finish", function () {
res.send(200,"Upload complete");
});
next();
}
var server = restify.createServer();
server.post('/api/uploadfile/:devicename/:filename', uploadFile);
server.listen(8080, function() {
console.log('%s listening at %s', server.name, server.url);
});