Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upload images to Google Cloud Storage using Google App Engine?

I am trying to figure out a way to upload an image into Google Cloud Storage using Google App Engine.

I have checked:

Sending images to google cloud storage using google app engine

Upload images/video to google cloud storage using Google App Engine

They all show how to do it using the BlobStore API.

When I checked the BlobStore API:https://cloud.google.com/appengine/docs/python/blobstore/

They have a note to use Google Cloud Storage instead. What's the current status of BlobStore and will it be supported in the future?

I see an example for image upload: https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/appengine/standard/blobstore/main.py using BlobStore API.

Is there an example for Google Cloud Storage using Google App Engine?

like image 882
ssk Avatar asked Feb 06 '23 14:02

ssk


1 Answers

Uploading images through App Engine has three problems:

First, it's very inefficient. You are using your App Engine instance hours to simply pass-through data from a user's browser to Google Cloud Storage.

Second, it's slower (again, because you use an intermediary).

Finally, App Engine does not support streaming and all requests are limited to 32MB.

The best option is to upload files directly to Cloud Storage using one of the upload options.

like image 194
Andrei Volgin Avatar answered Feb 11 '23 17:02

Andrei Volgin