Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4730 มุมมอง

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
8884
1
พ.ค. 25
1136
0
ม.ค. 24
1821
1
ก.พ. 22
24004
0
ม.ค. 22
2853