Skip to Content
Menu
This question has been flagged
1 Odpoveď
4728 Zobrazenia

Hello,

I have a binary field and I would like get the size of this file for prevent the upload.

How can I do ?


Thanks

Avatar
Zrušiť
Best Answer

How about a function in a custom module? Here's the most relevant part you need 

import os

check_size = os.path.getsize("/path/filename")
print check_size # not needed, is just for a quick dev check.

The rest of the logic depends on what you need to do exactly. 

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
3
júl 25
8883
1
máj 25
1136
0
jan 24
1821
1
feb 22
24004
0
jan 22
2853