Google cloud storage: upload large file inside with a POST request (old createUploadUrl)

Viewed 71

I'm migrating from PHP 5+ to PHP 7+ on standard app engine.

To upload file, I'm making a POST request to an internal endpoint with all form data (text and file to upload).

Actually what I was doing on v5 to let this work:

  1. Get the URL with CloudStorageTools::createUploadUrl
  2. POST everything to the url returned from the step before

In this way, all posted form (text and file to upload) was posted correctly to my internal endpoint and file can be uploaded on google storage.

Migrating to php 7+ CloudStorageTools::createUploadUrl can't be used. Direcly upload working fine, if file is not so bigger.

For bigger file I haven't still found a solution, a lot of people have this problem but seems no one actually solved it.

There is some workaround or some tips to solve it? I've already tested different methods got from here: https://googleapis.github.io/google-cloud-php/#/docs/cloud-storage/v1.23.2/storage/readme No one is actually working (I got URL where upload, but at the end of upload everything crash).

Google documentation about that is not so clear, they say you can't use the older library, but actually online I can find always the same basically code that it's not good for larger file.

0 Answers
Related