Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
4727 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
3
Jul 25
8883
1
Mei 25
1135
0
Jan 24
1821
1
Feb 22
24004
0
Jan 22
2853