Skip to content

Instantly share code, notes, and snippets.

@prefork
Created June 18, 2010 21:56
Show Gist options
  • Save prefork/444283 to your computer and use it in GitHub Desktop.
Save prefork/444283 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Google Storage File Upload Example</title>
</head>
<body>
<div>
<form action="http://YOUR-BUCKET.commondatastorage.googleapis.com" enctype="multipart/form-data" method="post">
<fieldset>
<input type="hidden" name="key" value="someAmazingUniqueKey"/>
<input type="file" name="file" size="chars"/>
<input type="submit" value="Send"/>
</fieldset>
</form>
</div>
</body>
</html>

Google Storage Uploads

The above code assumes a few things:

  • YOUR-BUCKET is a bucket that you own.

  • You have set the ACL on the bucket with the following command: gsutil setacl public-read-write gs://upload-test

  • The "key" is dynamically generated

The above operation results in a file being created at: http://commondatastorage.googleapis.com/upload-test/someAmazingUniqueKey

-Nate (nate at grapepudding.com)

@prefork
Copy link
Author

prefork commented Jun 18, 2010

My markup is valid now, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment