Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4738 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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. 

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
3
lip 25
8886
1
maj 25
1140
0
sty 24
1821
1
lut 22
24010
0
sty 22
2865