Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
4741 Представления

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

Аватар
Отменить
Лучший ответ

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. 

Аватар
Отменить
Related Posts Ответы Просмотры Активность
3
июл. 25
8889
1
мая 25
1142
0
янв. 24
1822
1
февр. 22
24012
0
янв. 22
2867