marmelab / ng-admin

Add an AngularJS admin GUI to any RESTful API
http://ng-admin-book.marmelab.com/
MIT License
3.95k stars 725 forks source link

Multi-file upload uploads same file n times #1390

Closed glalaj closed 6 years ago

glalaj commented 6 years ago

Scope

I have a file upload field in a form where I enabled multiple upload adding multiple: true

 nga.field('epg_file','file')
    .uploadInformation({ 'url': '/file-upload/single-file/epg/epg_file', 'accept': 'image/*, .csv, text/xml, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'apifilename': 'result', 'multiple': 'true'})

When the form is submitted, it makes a (post) request to this API: /api/process_file

Prerequisites

Description

When using multiple file upload to upload n files, the http request parameter containing the names of the files uploaded contains the last file n times instead of the names of all files. This does not happen every single time, but it does happen most of it (~90% of the time). I was unable to find a pattern of when the upload happens correctly.

Steps to Reproduce

  1. I click on 'Browse' button and select several files. Let's say I select 3 files, test1.csv test2.csv and test3.csv.
  2. After I click on submit, all files are uploaded. A request is made towards /api/process_file, with the form data.

Expected behavior: The epg_file param of the request is 'test1.csv, test2.csv, test3.csv'

Actual behavior: The epg_file param of the request is 'test3.csv, test3.csv, test3.csv'