I'm trying to upload to cloud storage from my app engine app but it keeps uploading the name of the file instead of its contents.
The html is pretty simple:
<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 like this:
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')
with files.open(writable, 'a') as f:
f.write(upload)
files.finalize(writable)
self.response.write('done')
I know f.write(upload)
is definitely wrong but I have no idea what i'm supposed to replace it with