跳至內容
選單
此問題已被標幟
1 回覆
4747 瀏覽次數

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
7月 25
8902
1
5月 25
1159
0
1月 24
1835
1
2月 22
24020
0
1月 22
2891