Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
4723 Näkymät

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
Hylkää
Paras vastaus

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
3
heinäk. 25
8881
1
toukok. 25
1135
0
tammik. 24
1821
1
helmik. 22
24002
0
tammik. 22
2853