Загрузка файла не работает на Sails.js

Я пытаюсь загрузить изображение на сервер, используя код ниже. Он отлично работает для небольших изображений до ~70 КБ.

Для больших изображений устанавливается статус файла cancelled, сохраняет на серверный диск, но с размером 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;

Я использую Sails 0.10.0-rc7.

Есть идеи?

0 ответов

Другие вопросы по тегам