تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
4735 أدوات العرض

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. 

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
3
يوليو 25
8885
1
مايو 25
1140
0
يناير 24
1821
1
فبراير 22
24009
0
يناير 22
2862