Hello, I’m using digital ocean to allow users to upload videos using signed urls. However i wanna make sure the the file is the file size it request to upload, and current after hours of searching for an answer i cannot find one.
So my question is, how can i prevent users to steal the signed url and upload a massive file?
PS: I’m using ‘@aws-sdk/s3-request-presigner’ with the function getSignedUrl() as the example from DO says
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Heya,
If you’re looking to limit the upload size of files using pre-signed URLs, you can achieve this by using content-length-range in the conditions of your pre-signed URL policy. Set a minimum and maximum file size range to restrict uploading of larger files.
Here’s an example:
- "conditions": [
- ["content-length-range", _minSize_, _maxSize_]
- ]
By replacing the minSize and maxSize values with your desired file size limits, you can prevent users from uploading files outside that size range.
For more details on how to control the size of the uploaded files, please refer to DigitalOcean Spaces Documentation: Handling File Uploads.
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.