İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
4742 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
3
Tem 25
8889
1
May 25
1142
0
Oca 24
1822
1
Şub 22
24012
0
Oca 22
2867