title: Binary Data Posting with curl
body: <p>So basically, I'm trying to write a series of scripts to interact with Dot Net Nuke. I've been analysing the traffic and can now login and do some basic tasks. However, I've never handled binary file upload with curl. Would someone be willing to look at this to help me out? Here's the anatomy of the request:</p>
  
  <p><a href="http://pastebin.com/qU8ZEMaQ" rel="noreferrer">http://pastebin.com/qU8ZEMaQ</a></p>
  
  <p>Here's what I've got for curl so far:</p>
  
  <p><a href="http://pastebin.com/LG2ubFZG" rel="noreferrer">http://pastebin.com/LG2ubFZG</a></p>
  
  <p>edit: For the lazy -</p>
  
  <p><em>length of the file is achieved and stored in LENGTH</em><br>
  STUFF is just a copy/paste of the request URL with parameters, minus the URL itself.</p>
  
  <pre><code>curl -L --cookie ~/.cms --data-binary "@background.jpg" \
  --header "Content-Length: $LENGTH" \
  --header "Content-Disposition: form-data" \
  --header "name=\"RadFileExplorer1_upload1file0\"" \
  --header "Content-Type: image/jpg" \
  --header "Filename=\"background.jpg\"" \
  --data $STUFF \
  --referer "Kept-Secret" \
  "Kept-Secret"
  </code></pre>