I'm programming a module in OpenERP to upload multiple images from a folder in one go, using HTML5 input multiple without uploading pictures one at a time and not store them in the database, with the loss of performance that implies, I save them as files, I have a form with a Widget that makes a POST request to a controller, the problem is that it print only the last FileStorage object, when I send more than one, to upload multiple files at a time , however I can not find how to modify it because I do not even like the web client decides to send an object of type FileStorage or other object!
My Widget
<t t-name="HiddenInputFileMulti">
<div t-attf-class="oe_hidden_input_file #{fileupload_class or ''}" t-att-style="fileupload_style">
<form class="oe_form_binary_form" t-att-target="fileupload_id" method="POST" enctype="multipart/form-data" action="/web/binary/multi_picture_upload">
<t t-raw="__content__"/>
<input type="file" id="files" class="oe_form_binary_file" name="ufile" accept="image/*" multiple=""/>
</form>
</div>
</t>
My controller:
from openerp.addons.web import http as openerpweb
from openerp.addons.web.controllers.main import Binary@openerpweb.httprequest
def multi_picture_upload(self, req, ufile):print ufile #this print the last FileStorage object, in a dict like :FileStorage: u'tula.gif' ('image/gif')
EDIT:
I say forget that when I print the contents of ufile, It returns a dictionary with a single pair
<FileStorage: u'tula.gif' ('image/gif')>
this is the last picture I sent, and analyzing the request indeed, the web client sends all pictures, but the controller only receives the last, it seems like they just dismiss all previous images ....