Is it possible to upload files directly to the Google Cloud Storage?

dominikweber picture dominikweber · Apr 26, 2015 · Viewed 12.8k times · Source

I have written a file upload for larger files that is uploading the files to the Cloud Storage. Unfortunately this takes a while, because the Files are uploaded to the web server first, and then again from the web server to the Google Cloud Storage. Is there a way to upload files directly to the Cloud Storage with the Google PHP Api Client (https://github.com/google/google-api-php-client)? I couldn't find anything on this topic in the docs.

Answer

Andrei Volgin picture Andrei Volgin · Apr 26, 2015

You need to create an upload URL with the name of your bucket, and the upload will go directly into that bucket.

https://cloud.google.com/appengine/docs/php/googlestorage/user_upload