title: QT upload (PUT) a file
body: <p>I am using QT to upload a file to a web server. The web server accepts files using the following request:</p>
  
  <pre><code>curl -X POST -H 'Content-Type:multipart/form-data' 
  -H 'Authorization: Token &lt;token&gt;' 
  -F 'file=@file_to_upload.txt' 
  https://some.web.site/api/v2/files/contents/
  </code></pre>
  
  <p>I am using roughly this QT calls to try to accomplish the same:</p>
  
  <pre><code>QHttpMultiPart multiPart(QHttpMultiPart::FormDataType);
  QHttpPart filePart;
  
  file.open(QIODevice::ReadOnly)
  
  filePart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data");
  filePart.setBodyDevice(file);
  multiPart.append(filePart);
  
  QNetworkAccessManager mgr;
  QNetworkRequest req(url);
  req.setRawHeader("Authorization", ("Token &lt;token&gt;").data());
  
  QNetworkReply * reply(mgr.put(req, &amp;multiPart));
  </code></pre>
  
  <p>Right now this is what I get from the server:</p>
  
  <pre><code>File object is missing or invalid.
  </code></pre>
  
  <p>Can someone stop what the QT part is missing compared to the curl command? I would guess qt is missing some step that curl does behind the scenes. I would rather prefer a solution that does not involve me putting the whole request together manually.</p>