diff --git a/gcloud/storage/bucket.py b/gcloud/storage/bucket.py index 68dcad9032d7..c8321aa98c1a 100644 --- a/gcloud/storage/bucket.py +++ b/gcloud/storage/bucket.py @@ -456,7 +456,7 @@ def copy_blob(blob, destination_bucket, new_name=None, new_blob._set_properties(copy_result) return new_blob - def upload_file(self, filename, blob_name=None, connection=None): + def upload_file(self, filename, blob_name=None, connection=None, content_type=None): """Shortcut method to upload a file into this bucket. Use this method to quickly put a local file in Cloud Storage. @@ -480,6 +480,15 @@ def upload_file(self, filename, blob_name=None, connection=None): >>> print bucket.list_blobs() [] + The content type of the file can also be specified + + >>> from gcloud import storage + >>> connection = storage.get_connection() + >>> bucket = storage.get_bucket('my-bucket', connection=connection) + >>> bucket.upload_file('~/my-file.txt', 'remove-text-file.txt', content_type='application/octet-stream') + >>> print bucket.list_blobs() + [