コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
4725 ビュー

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
8883
1
5月 25
1135
0
1月 24
1821
1
2月 22
24004
0
1月 22
2853