title: Upload a file to Google Cloud, in a specific directory
body: <p>How to upload a file on Google Cloud, in a specific bucket directory (e.g. <code>foo</code>)?</p>
  
  <pre><code>"use strict";
  
  const gcloud = require("gcloud");
  
  const PROJECT_ID = "&lt;project-id&gt;";
  
  let storage = gcloud.storage({
    projectId: PROJECT_ID,
    keyFilename: 'auth.json'
  });
  
  let bucket = storage.bucket(`${PROJECT_ID}.appspot.com`)
  bucket.upload("1.jpg", (err, file) =&gt; {
      if (err) { return console.error(err); }
      let publicUrl = `https://firebasestorage.googleapis.com/v0/b/${PROJECT_ID}.appspot.com/o/${file.metadata.name}?alt=media`;
      console.log(publicUrl);
  });
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>bucket.file("foo/1.jpg").upload("1.jpg", ...)
  </code></pre>
  
  <p>But there's no <code>upload</code> method there.</p>
  
  <p>How can I send <code>1.jpg</code> in the <code>foo</code> directory?</p>
  
  <p>In Firebase, on the client side, I do:</p>
  
  <pre><code>ref.child("foo").put(myFile);
  </code></pre>