Best way to upload images to Google Cloud Storage?

45 views Asked by At

Background: Currently trying to implement a feature so that users on my site can upload their profile image to GCS.

I understand that there are two ways you could upload objects when using the client library:

The standard way (see here: https://cloud.google.com/storage/docs/uploading-objects#storage-upload-object-nodejs) and 2. doing it with a Signed URL (see here: https://cloud.google.com/storage/docs/samples/storage-generate-upload-signed-url-v4)

Just wondering which way would be better for my particular use case?

1

There are 1 answers

0
John Hanley On BEST ANSWER

The first link requires the user to upload their objects to your server (running Node.js) and then your server uploads the objects to Google Cloud Storage. This common method ensures security as the objects can be scanned before uploading to Cloud Storage.

Signed URLs are usually recommended because the client uploads directly to Cloud Storage bypassing your server.

The best method depends on the size of the objects, reliability of the client's networks, security objectives, network costs (ingress and egress), how trusted the clients are, etc.