-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.
Description
Storage snippet for generate_upload_policy seems to be broken. I looked at the docs but I don't see where the breakdown is.
Here's the output when trying to upload with the generated HTML form.
<Error>
<Code>InvalidArgument</Code>
<Message>Invalid argument.</Message>
<Details>Cannot create buckets using a POST.</Details>
</Error>bucket = client.bucket('my-bucket24356uytrew')
conditions = [
['starts-with', '$key', ''],
{'acl': 'public-read'}]
policy = bucket.generate_upload_policy(conditions)
# Generate an upload form using the form fields.
policy_fields = ''.join(
'<input type="hidden" name="{key}" value="{value}">'.format(
key=key, value=value)
for key, value in policy.items()
)
upload_form = (
'<form action="http://{bucket_name}.storage.googleapis.com"'
' method="post" enctype="multipart/form-data">'
'<input type="text" name="key" value="">'
'<input type="hidden" name="bucket" value="{bucket_name}">'
'<input type="hidden" name="acl" value="public-read">'
'<input name="file" type="file">'
'<input type="submit" value="Upload">'
'{policy_fields}'
'<form>').format(bucket_name=bucket.name, policy_fields=policy_fields)
print(upload_form)Metadata
Metadata
Assignees
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.