Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
4733 Vues

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
Ignorer
Meilleure réponse

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
Ignorer
Publications associées Réponses Vues Activité
3
juil. 25
8885
1
mai 25
1139
0
janv. 24
1821
1
févr. 22
24009
0
janv. 22
2854