Skip to content

Instantly share code, notes, and snippets.

@evsapi
Forked from kinlane/uploadfile.py
Created May 14, 2012 21:41
Show Gist options
  • Save evsapi/2697445 to your computer and use it in GitHub Desktop.
Save evsapi/2697445 to your computer and use it in GitHub Desktop.
IDrive - EVS - REST API - uploadFile
<%
import sys, urllib, urllib2
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
from xml.dom.minidom import parseString
import xml.dom.minidom as xdm
register_openers()
uid = "[your user]"
pwd = "[your password]"
# With the URL Upload File
base_url = '[base url from previous get server request]'
url = base_url + '/evs/uploadFile'
localfile = '[path to your local file to upload]'
targetfolder = '[folder you wish to upload on IDrivesync]'
values = {'file':open(localfile),
'uid':uid,
'pwd':pwd,
'p':targetfolder
}
data, headers = multipart_encode(values)
request = urllib2.Request(url, data, headers)
request.unverifiable = True
response = urllib2.urlopen(request)
the_page = response.read()
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment