title: react-native upload image and data to api using axios
body: <p>how to upload image to api using axios</p>
  
  <p>i want to upload image with data to api using axios
  i try with formdata but it did not work see below my code</p>
  
  <p><a href="https://i.stack.imgur.com/t7i2L.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t7i2L.jpg" alt="how it work in postman"></a></p>
  
  <p>and this is my code </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>uploadToServer= () =&gt; {
      const file =this.state.photo
  
  
  
  let formdata = new FormData()
  formdata.append('sale_id', 1)
  formdata.append('note_type_id', 4)
  
  formdata.append('description', "test")
  
  formdata.append('note_content_item', "test")
  
  formdata.append('Note', file)
  
  
     axios.post('api',
          {data:formdata},{headers: {
            'Content-Type' : 'multipart/form-data',
            'Authorization':'xx'
              }
  
            })
          .then(resp =&gt; console.log(resp))
          .catch(error =&gt; console.error(error)); 
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>i try a lot of solution but it give me 
  Error: Request failed with status code 500</p>