Skip to Content
Menu
This question has been flagged
1 Atsakyti
4736 Rodiniai

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

Portretas
Atmesti
Best Answer

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. 

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
3
liep. 25
8885
1
geg. 25
1140
0
saus. 24
1821
1
vas. 22
24009
0
saus. 22
2863