title: Cloudinary image upload from React: am including Cloudinary unsigned preset but get "Upload preset must be specified when using unsigned upload"
body: <p>I'm trying to construct a simple Cloudinary image upload based on this codepen example: <a href="https://codepen.io/team/Cloudinary/pen/QgpyOK" rel="nofollow noreferrer">https://codepen.io/team/Cloudinary/pen/QgpyOK</a> -- </p>
  
  <p>I've converted it to work with <code>fetch</code> but even though I've gone to my Cloudinary settings and created an unsigned upload preset, which I'm providing to the headers, I'm still getting an error</p>
  
  <p><code>POST https://api.cloudinary.com/v1_1/myproject/upload 400 (Bad Request)</code></p>
  
  <p>with the error message</p>
  
  <p><code>Upload preset must be specified when using unsigned upload</code></p>
  
  <p>The code I'm using is the following </p>
  
  <pre><code>_callCloudinaryApi(file, method = 'post') {
  
      const config = {
        method
      }
  
      const cloudName = "myproject" // fictional project name here
      const unsignedUploadPreset = "mypreset" // fictional preset name here
      const url = `https://api.cloudinary.com/v1_1/${cloudName}/upload`;
  
  
      const fd = new FormData();
      fd.append('upload_preset', unsignedUploadPreset);
      fd.append('tags', 'browser_upload'); // Optional - add tag for image admin in Cloudinary
      fd.append('file', file);
  
  
      if (method !== 'get') {
        config.headers = {}
        config.headers['X-Requested-With'] = 'XMLHttpRequest'
      }
  
      return fetch(url, config)
        .then(res =&gt; res.json())
        .then(res =&gt; {
         console.log(res)
          return res;
        })
    }
  </code></pre>
  
  <p>Can anyone help me to determine what the problem might be?  Thanks very much!</p>