Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
4744 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns

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. 

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
3
iul. 25
8891
1
mai 25
1145
0
ian. 24
1824
1
feb. 22
24013
0
ian. 22
2880