Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

[V8] Get file size

By
Dorcy Valérian
on 7/16/15, 8:39 AM 384 views

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

0
FEDERICO LEONI
On 7/17/15, 11:27 AM

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. 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/16/15, 8:39 AM
Seen: 384 times
Last updated: 7/18/15, 9:32 AM