title: Upload NodeJS API
body: <p>I'm stucked for more than one week with a problem. I'm trying to implement a <strong>PDF upload</strong> from mobile application created with <strong>React-Native</strong>, <strong>API in NodeJs</strong>, but I can't upload the pdf on the server, even with <strong>Postman</strong>. Here is the test I did following a tutorial from the net : </p>
  
  <pre><code>const multer = require('multer')
  
  var Storage = multer.diskStorage({
      destination: (req, file, callback) =&gt; {
          callback(null, "./uploads");
      },
      filename: (req, file, callback) =&gt; {
          callback(null, file.fieldname + "_" + Date.now() + "_" + file.originalname);
      }
  });
  
  var upload = multer({
      storage: Storage
  }).array("test", 0);
  
  module.exports = {
      add_quotation: (req, res) =&gt; {
  
          let token = req.get('x-access-token')
          let decoded = jwt.decode(token);
  
          upload(req, res, (err) =&gt; {
              if (err) {
                  return res.end("Something went wrong!");
              }
              return res.end("File uploaded sucessfully!.");
          });
  
      }
  }
  </code></pre>
  
  <p>Via Postman, I have this error :</p>
  
  <blockquote>
    <p>SyntaxError: Unexpected token # in JSON at position 0
        at JSON.parse ()
        at createStrictSyntaxError (D:\Logiciels\wamp64\www\project\PFE\ReactNative\homi-back\node_modules\body-parser\lib\types\json.js:157:10)
        at parse (D:\Logiciels\wamp64\www\project\PFE\ReactNative\homi-back\node_modules\body-parser\lib\types\json.js:83:15)
        at D:\Logiciels\wamp64\www\project\PFE\ReactNative\homi-back\node_modules\body-parser\lib\read.js:116:18
        at invokeCallback (D:\Logiciels\wamp64\www\project\PFE\ReactNative\homi-back\node_modules\raw-body\index.js:224:16)
        at done (D:\Logiciels\wamp64\www\project\PFE\ReactNative\homi-back\node_modules\raw-body\index.js:213:7)
        at IncomingMessage.onEnd (D:\Logiciels\wamp64\www\project\PFE\ReactNative\homi-back\node_modules\raw-body\index.js:273:7)
        at emitNone (events.js:105:13)
        at IncomingMessage.emit (events.js:207:7)
        at endReadableNT (_stream_readable.js:1059:12)
        at _combinedTickCallback (internal/process/next_tick.js:138:11)
        at process._tickCallback (internal/process/next_tick.js:180:9)</p>
  </blockquote>
  
  <p>If someone could help me I would really appreciate !</p>
  
  <p>Thanks in advance</p>