Skip to content

Instantly share code, notes, and snippets.

@lucadealfaro
Created March 8, 2016 22:49
Show Gist options
  • Save lucadealfaro/6e83d9e4f70551f6109b to your computer and use it in GitHub Desktop.
Save lucadealfaro/6e83d9e4f70551f6109b to your computer and use it in GitHub Desktop.
def upload():
f = request.vars.file.file # This is the file.
# See here for docs: https://cloud.google.com/appengine/docs/python/googlecloudstorageclient/functions
gcs_file = cloudstorate.open("mybucket/myfilename", 'w', content_type="image/jpeg")
gcs_file.write(f.read())
gcs_file.close()
f.close()
return "ok"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment