Reputation: 2400
class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
def post(self):
reseller_id = self.request.get('reseller_id')
upload_files = self.request.get('logo_img')
if upload_files:
blob_info = upload_files[0]
key = blob_info.key()
I get an error at the line
key = blob_info.key()
error:
AttributeError: 'str' object has no attribute 'key
The thing is the file uploads correctly and I can see it in the GAE blob viewer. I copied this code from the Upload example here:
https://developers.google.com/appengine/docs/python/blobstore/overview#Complete_Sample_App
I am at a loss as to why I am not getting the key value by using blob_info.key() any pointers will be welcome.
Upvotes: 1
Views: 192
Reputation: 8199
Note that in the example they do:
upload_files = self.get_uploads('file') # 'file' is file upload field in the form
In your example upload_files is the value the user set for the logo_img field, which is a string.
I imagine the logo_img field is the file the user is uploading , so you would need to do instead
upload_files = self.get_uploads('logo_img')
Upvotes: 2