Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
4745 Visualizações

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
Cancelar
Melhor resposta

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
3
jul. 25
8891
1
mai. 25
1145
0
jan. 24
1824
1
fev. 22
24013
0
jan. 22
2880