Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
3203 Visualizzazioni

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
Abbandona
Risposta migliore
 enctype="multipart/form-data">

please add this into your form in HTML 

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

and this 


Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
ott 24
1744
2
set 23
2987
1
giu 23
2487
3
ago 25
7659
0
ott 21
2328