title: How do you use a signed policy from google-cloud/storage to upload data?
body: <blockquote>
    <p>ref:
    <a href="https://cloud.google.com/nodejs/docs/reference/storage/1.5.x/File#getSignedPolicy" rel="nofollow noreferrer">https://cloud.google.com/nodejs/docs/reference/storage/1.5.x/File#getSignedPolicy</a></p>
  </blockquote>
  
  <p>I am trying to upload files to my bucket using signed policies. Using the example from the documentation I get a response from my bucket object for 3 items.</p>
  
  <pre><code>"policyString": "{\"expiration\":\"2019-10-18\",\"conditions\":[[\"eq\",\"$key\",\"image.jpg\"],{\"bucket\":\"my-bucket\"},[\"eq\",\"$Content-Type\",\"image/jpeg\"],[\"content-length-range\",0,1024]]}",
  "policyBase64": "[some-long-string]",
  "policySignature": "[some-long-string]"
  </code></pre>
  
  <p>In the documentation it also shows you how to upload objects using curl.</p>
  
  <blockquote>
    <p>ref:
    <a href="https://cloud.google.com/storage/docs/object-basics#upload-object-json" rel="nofollow noreferrer">https://cloud.google.com/storage/docs/object-basics#upload-object-json</a></p>
  </blockquote>
  
  <p>How do you assemble what I get back as a signed policy and the upload api</p>
  
  <p><a href="https://www.googleapis.com/upload/storage/v1/b/[BUCKET_NAME]/o?uploadType=media&amp;name=[OBJECT_NAME]" rel="nofollow noreferrer">https://www.googleapis.com/upload/storage/v1/b/[BUCKET_NAME]/o?uploadType=media&amp;name=[OBJECT_NAME]</a></p>
  
  <p>to upload a file to my bucket using axios? Is there other headers to attach?</p>
  
  <p>Here is what I did to take a stab at it but I'm not sure.</p>
  
  <pre><code>const options = {
    headers: {
       'Authorization': ?
       'Content-Type': file.type
    }
  }
  axios.put(concatenatedPolicySignatureUrl, file, options)
    .then(response =&gt; {
        console.log('success!');
    }
  </code></pre>