title: Upload a file with php curl
body: <p>Sending the wrong mime-type. the file type "video/mp4" but "application / octet-stream" as the sending. I want to send "video/mp4".
  Curl option($file = real path)</p>
  
  <pre><code>$post = array('videoupload'=&gt;'1','input_1'=&gt;"@$file");
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
  curl_setopt($ch, CURLOPT_INFILESIZE,(string)filesize($file));
  curl_setopt($ch, CURLOPT_INFILE,fopen($file,'r'));
  </code></pre>
  
  <p>Http debugger Out</p>
  
  <blockquote>
    <blockquote>
      <p>------------------------------94a50e65d9fe Content-Disposition: form-data; name="videoupload"</p>
    </blockquote>
    
    <p>1
    ------------------------------94a50e65d9fe Content-Disposition: form-data; name="input_1"; filename="1.mp4" Content-Type:
    application/octet-stream</p>
  </blockquote>
  
  <p>I've tried it</p>
  
  <pre><code>$post = array('videoupload'=&gt;'1','input_1'=&gt;"@$file;type=video/mp4");
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
  curl_setopt($ch, CURLOPT_INFILESIZE,(string)filesize($file));
  curl_setopt($ch, CURLOPT_INFILE,fopen($file,'r'));
  </code></pre>
  
  <p>curl_error out:</p>
  
  <blockquote>
    <p>failed creating formpost data</p>
  </blockquote>