Skip to content

Commit

Permalink
Fixes #3 - support files with whitespace and special chars
Browse files Browse the repository at this point in the history
  • Loading branch information
dideler committed Oct 5, 2012
1 parent 5971f8c commit 4c50578
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions geturl
Expand Up @@ -6,6 +6,7 @@ try:
except ImportError:
from check_output import check_output

import urllib
import json
import sys
import os
Expand Down Expand Up @@ -57,13 +58,15 @@ if len(sys.argv) != 2:
# Upload the file
print
print "Uploading the file to Filepicker.io..."
output = check_output('curl --progress-bar -F "fileUpload=@%(filename)s" -F "apikey=%(apikey)s" %(fpurl)s/api/path/storage/%(filename)s' %
{"filename": sys.argv[1], "apikey": APIKEY, "fpurl": FPURL}, shell=True)
filename = sys.argv[1]
fileurl = urllib.pathname2url(filename)
output = check_output('curl --progress-bar -F "fileUpload=@%(filename)s" -F "apikey=%(apikey)s" %(fpurl)s/api/path/storage/%(fileurl)s' %
{"filename": filename, "apikey": APIKEY, "fpurl": FPURL, "fileurl": fileurl}, shell=True)
data = json.loads(output)
url = data['data'][0]['url']

print
print "A Public Share URL for: %s" % sys.argv[1]
print "A Public Share URL for: %s" % filename
print url
print

Expand Down

0 comments on commit 4c50578

Please sign in to comment.