title: Can't get image_id from Cloudinary in NodeJS
body: <p>I'm using Node.js and Express. I just implement Cloudinary to upload image from user, and store the image id to my MySQL database.</p>
  
  <p>I tried this tutorial from Cloudinary's documentation: <a href="http://cloudinary.com/documentation/node_image_upload" rel="nofollow">http://cloudinary.com/documentation/node_image_upload</a>. Everything works well, except at the final step, I need to get the <code>image_id</code>. </p>
  
  <pre class="lang-js prettyprint-override"><code>  var url = require('url')  
    var url_parts = url.parse(req.body.coverurl, true)
    console.log(url_parts) //DEBUG
    var query = url_parts.query
    console.log(query) //DEBUG
  
    var preloaded_file = new cloudinary.PreloadedFile(query.image_id)
    if (preloaded_file.is_valid()) {
      var image_id = preloaded_file.identifier()
      console.log("Img ID:" + image_id)
    } else {
      console.log("Invalid upload signature")
    }
  </code></pre>
  
  <p>The <code>req.body.coverurl</code> is something like: <code>image/upload/v1426989769/f08eodnwt5zqfwb2bgpd.png#f63f1fe77c7f536447e079f3dd10829b5a15d862</code>
  The <code>url_parts</code> is: </p>
  
  <pre class="lang-json prettyprint-override"><code>{ protocol: null,
    slashes: null,
    auth: null,
    host: null,
    port: null,
    hostname: null,
    hash: '#f63f1fe77c7f536447e079f3dd10829b5a15d862',
    search: '',
    query: {},
    pathname: 'image/upload/v1426989769/f08eodnwt5zqfwb2bgpd.png',
    path: 'image/upload/v1426989769/f08eodnwt5zqfwb2bgpd.png',
    href: 'image/upload/v1426989769/f08eodnwt5zqfwb2bgpd.png#f63f1fe77c7f536447e079f3dd10829b5a15d862' }
  </code></pre>
  
  <p>And..., variable <code>query</code> is empty. <code>query.image_id</code> is invalid so can't get the image id, also can't verify the signature.</p>
  
  <p>I don't know why Cloudinary give this invalid callback string. Or how can I solve this problem. </p>
  
  <p>Thank for your help. And forgive me for my bad English :)</p>
  
  <p><strong>Update</strong></p>
  
  <p><strong>my submit_idea.hbs</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form action="/submit/idea" method="POST"&gt;
      {{{imgtag}}} &lt;!-- this will render from: cloudinary.uploader.image_upload_tag('coverurl') --&gt;
      &lt;button type="submit"&gt;Save&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>in my routes/submit.js</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>router.get('/submit/idea', function(req, res, next){
      // just render the submit_idea.hbs with some Cloudinary variable
  })
  
  router.post('/submit/idea', function(req, res, next){
    var url = require('url')  
    var url_parts = url.parse(req.body.coverurl, true)
    var query = url_parts.query
  
    var preloaded_file = new cloudinary.PreloadedFile(query.image_id)
    if (preloaded_file.is_valid()) {
      var image_id = preloaded_file.identifier()
      console.log("Img ID:" + image_id)
    } else {
      console.log("Invalid upload signature")
    }
  
    // add image_id to mysql
  })
  </code></pre>