1

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?

Ecil
  • 1,009
  • 1
  • 13
  • 28
  • for me, it happens not depending on file size. Every time I upload more then 1 file, each of them except first one is saved with 0 bytes. – ArVan Aug 14 '14 at 13:47

0 Answers0