in bookshelf/main.py [0:0]
def upload_image_file(img):
"""
Upload the user-uploaded file to Google Cloud Storage and retrieve its
publicly-accessible URL.
"""
if not img:
return None
public_url = storage.upload_file(
img.read(),
img.filename,
img.content_type
)
current_app.logger.info(
'Uploaded file %s as %s.', img.filename, public_url)
return public_url