Uploading a file to File Drop using http post method

Ok so after a long time of searching and trying I figured out a way to do this. Here is my solution in case somebody happens to be trying the same thing:

In Ruby we can upload easily using the PUT (not POST) with the mechanize gem:

webdav_path = "public.php/webdav/files/user/folder/#{filename}"
full_url = "https://example.com/#{webdav_path}"
agent = Mechanize.new
agent.add_auth(full_url, 'folder', '')
agent.put(full_url, File.open(filename, "r").read, {'X-Requested-With' => 'XMLHttpRequest', 'Content-Type' => 'application/zip'})

Seemed important to set the X-Requested-With header, to use the webdav path and to set basic auth to the folder as username and empty password.

Another thing I found very helpful to figure this out is this cURL script.