You can set the minimum and maximum file size in s3Policy that you create by setting up a signed downloadable URK for the direct browser to load S3.
Here is an example (JavaScript from the node.js application) - see the โreach reach lengthโ part below:
var s3Policy = { 'expiration': expiration, 'conditions': [{ 'bucket': aws.bucket }, ['starts-with', '$key', path], { 'acl': readType }, { 'success_action_status': '201' }, ['starts-with', '$Content-Type', request.type], ['content-length-range', 2048, 124857600],
If a user uploads a file that exceeds S3, he returns 400 bad requests with the body, including a message about exceeding the maximum file size limit.
Mick source share