Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
4740 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
3
lug 25
8889
1
mag 25
1142
0
gen 24
1822
1
feb 22
24012
0
gen 22
2867