title: Sails.js: How to know if the request contains a file to upload?
body: <p>I have the next action in one of my controllers, its function is upload a image file or create a new cover model using a video url, its work fine but when the request has a header <em>Content-Type: multipart/form-data</em> and does not contains a file the action throw a timeout error in  <code>req.file()</code>.  </p>
  
  <pre><code>upload: function(req, res) {
      res.setTimeout(0);
  
      function onCreateCover(err, cover) {
          if (err) {
              return res.negotiate(err);
          } else {
              res.status(201);
              return res.json(cover);
          }
      }
  
      if (/^multipart\/form-data/.test(req.headers['content-type'])) {
          req.file('image').upload({
              maxBytes: 2000000,
              dirname: coverDir
          }, function(err, uploadedFile) {
              if (err) {
                  res.serverError(err);
              } else if (uploadedFile.length &gt; 0) {
                  Cover.create({
                      title: req.body.title,
                      description: req.body.description,
                      path: uploadedFile[0].fd
                  }).exec(onCreateCover);
              }
          });
      } else {
          Cover.create(req.body).exec(onCreateCover);
      }
  }
  </code></pre>
  
  <p>I want to know if exist a method or way to check if request really contains a file</p>