¿How to configure the session URI to allow only a maximum file size?
Unfortunately, starting a resumable upload and passing a session URI to a client does not provide a way to limit file size.
There is, however, a way to do this. Instead of using a resumable PUT upload initiated by the server, have the client initiate its own POST upload using a signed policy document. Policy documents allow the server to provide a list of requirements that an upload must fulfill, one of which is an acceptable range of file sizes. Specifically, you'll need to include this section:
["content-length-range", <min_range>, <max_range>]
You can read about policy documents and how to craft them here: https://cloud.google.com/storage/docs/xml-api/post-object#policydocument
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With