'Logic question related to file size check during implementation of aws file upload

I am implementing aws file upload, does aws provide a method to check the size of a file when it is uploaded? I am developing using springboot in java. Thank you

I did a search related to aws, but it was difficult to find it by myself, so I had to post a question.



Solution 1:[1]

If you are using aws sdk, you can get the size of the file in bytes by using the getSize() method in the S3ObjectSummary class after uploading the file.

See the List Objects doc or the Class S3ObjectSummary doc.

Or if you want to get the size of a file before uploading, access the file directly and get the size of the file.

File file = new File(path);
long length = file.length();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 GGalJJak