I'm trying to upload an image to the server using the code below. It works fine for small images up to ~70KB.
For larger images it sets the file status to cancelled
, saves to server disk but with a size of Zero KB.
var CustomerController = {
uploadPhoto: function (request, response) {
var customerId = request.param('id');
// check for the existence of the customer
Customer.findOne({
id: customerId
}).exec(function (err, customer) {
if (err || !customer) {
return response.notFound('Customer not found');
}
// get the file that was uploaded from the client
// and save it to disk
request.file('photo').upload(function onUploadComplete(err, files) {
if (err || !files || files.length < 1)
return response.serverError('Error uploading photo: ' + err);
// do something with files here
});
});
},
_config: {}
};
module.exports = CustomerController;
I'm using Sails 0.10.0-rc7.
Any ideas?