I need an application that let users upload files to a public path where others can download it, but they are not allowed to upload a file that already exists. To check it faster i need to know the requested file's size and compare with file size of the others already uploaded files.
The problem:
file = request.files['file'] #returns FileStorage
And in the docs there is no reference to how get the file size. After using file.save(public_path_to_file)
I can get the file size using os.stat(public_path_to_file).st_size
. But before using save() I have not found a way to get the size of the incomming file.
Do you have any ideas?