title: Upload a file using json API android
body: <p>Hi im working on a android app for bayfiles, where you can view, delete and upload files. They have a API for uploading files to their server using their Json API, but i can figure out how to do so. What the documentation says:</p>
  
  <blockquote>
    <p>/file/uploadUrl</p>
    
    <p>{ error: "", uploadUrl: , progressUrl:  }</p>
    
    <p>The returned URL is valid for a limited amount of time, you need to
    request a new one for each upload. Issue a POST request to the
    "uploadUrl" to upload the file. You can poll "progressUrl" to fetch
    the current progress. The POST request needs to be multipart/form-data
    encoded and contain a "file" field. cUrl example: curl -F
    "file=@somefile.rar"
    "<a href="http://s6.baycdn.com/upload/93b37e57/4e691e0c/6/0?X-Progress-ID=4e639fcd34CC2F73796CF81679C605643A8F99CF" rel="nofollow">http://s6.baycdn.com/upload/93b37e57/4e691e0c/6/0?X-Progress-ID=4e639fcd34CC2F73796CF81679C605643A8F99CF</a>"
    Note: in order to upload a file to your account, you need to first log
    in using /account/login and then append ?session=XYZ to
    /file/uploadUrl On success, the "uploadUrl" will respond with an
    object: { error: "", fileId: , size: , sha1: ,
    infoToken: , deleteToken: , linksUrl: ,
    downloadUrl: , deleteUrl: , }</p>
  </blockquote>
  
  <p>I cant understand how to do this using android. Any help is much appreciated!</p>