Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
2881 Tampilan

I have the following view and controller, and want to access the uploaded file data and other attributes (extension, size, etc), how can I do it? I couldn't find any documentation about it.

View:


    
    
    


Controller:

from odoo import http

class Claim(http.Controller):
@http.route('/example_route/', auth='public', methods=["POST"], website=True)
def claims(self, **kw):  
        file = kw["fileExample"] # file now only has the name of the file
        # I want to use the file here (send it to and api, check the size and extension)



Using Odoo 13

Thanks for the help


Avatar
Buang
Jawaban Terbai
 enctype="multipart/form-data">

please add this into your form in HTML 

logo = kwargs.get('logo')
logo = base64.b64encode(logo.read())

and this 


Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
0
Okt 24
1090
2
Sep 23
2352
1
Jun 23
1969
3
Jun 22
6690
0
Okt 21
1610