Upload to Google Cloud Storage -
Upload to Google Cloud Storage -
i'm trying upload cloud storage app engine app keeps uploading name of file instead of contents.
the html pretty simple:
class="lang-html prettyprint-override"><form id="uploadbanner" enctype="multipart/form-data" action="/upload"> <input id="fileupload" name="myfile" type="file" /> <input type="submit" value="submit" id="submit" /> </form> the python element goes this:
class="lang-python prettyprint-override">class uploader(webapp2.requesthandler): def get(self): objectname = '%s'%str(uuid.uuid4()) objectpath = '/gs/bucketname/%s' %objectname upload = self.request.get('myfile') writable = files.gs.create(filename=objectpath, mime_type='application/octet-stream', acl='public-read') files.open(writable, 'a') f: f.write(upload) files.finalize(writable) self.response.write('done') i know f.write(upload) wrong have no thought i'm supposed replace with
you should allow browser upload straight gcs, , handler called afterwards.
to short overview of how can done, @ post: upload images/video google cloud storage using google app engine
even if blobstore api seems called in example, files uploaded cloud storage.
google-app-engine google-cloud-storage google-api-python-client
Comments
Post a Comment