Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
3224 Weergaven

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
Annuleer
Beste antwoord
 enctype="multipart/form-data">

please add this into your form in HTML 

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

and this 


Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
okt. 24
1751
2
sep. 23
3003
1
jun. 23
2496
3
aug. 25
7676
0
okt. 21
2340