title: react native post form data with object and file in it using axios
body: <p><a href="https://i.stack.imgur.com/D1Xdf.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/D1Xdf.jpg" alt="enter image description here"></a></p>
  
  <p>so i want to upload 
  object as data 
  and file as Note 
  to api using axios</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 data2 ={sale_id:1,
              note_type_id:4,
              description:"test",
              note_content_item:" hi from broker hub"
              
              }
  
  
  
  let data = new FormData()
  data.append('data[sale_id]', '1')
  data.append('data[note_type_id]', '4')
  
  data.append('data[description]', "test")
  
  data.append('data[note_content_item]', "test")
  
  
  
  
  
  
  
  console.log(data)
  
  
  axios({
    url: api',
    method: 'POST',
    data: data,
    headers: {
     
              'Content-Type' : 'multipart/form-data',
            'Authorization':'Basic YnJva2VyOmJyb2tlcl8xMjM='
  
    }
  })
          .then(resp =&gt; console.log(resp.data.response))
          .catch(error =&gt; console.error(error)); 
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>first i am trying with data without Note i can do it in postman</p>
  
  <p><a href="https://i.stack.imgur.com/7iJ2p.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7iJ2p.png" alt="enter image description here"></a></p>
  
  <p>but with my code i got error</p>
  
  <p>message: "Can not save file"
  response_code: 10</p>
  
  <p>i got this error only if i change the key from data to something else
  <a href="https://i.stack.imgur.com/EWr8Y.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EWr8Y.png" alt="enter image description here"></a></p>