question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

there is only one file in $_FILES when uploading multiple files

See original GitHub issue

eventhough I’m trying it on the latest chrome, any idea where the problem could be?

                $scope.doSubmit = function() {

                        $upload
                            .upload( {
                                url: '/api/send-fellowship',
                                data: $scope.form,
                                file: $scope.form.files
                            })
                            .progress(function(e) {
                                $scope.progress = parseInt(100.0 * e.loaded / e.total);
                            })
                            .success(function(data, status) {

                            });
                };

$scope.form.files is an array of files

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:29 (8 by maintainers)

github_iconTop GitHub Comments

16reactions
YangZhouChaoFancommented, Dec 21, 2015

请试试 arrayKey: ‘’ ,可是使得服务端接收的 files[0], files[1], files[2] 变成 files数组 请叫我红领巾。

3reactions
melloc01commented, Mar 3, 2015

Just to have a feedback for you people, this actually works. The way I made with a dynamic array was:


        var names = [];
        for (var i = files.length - 1; i >= 0; i--) 
            names.push(files[i].name);

        files.upload = $upload.upload({
            url: API_BASEURL + '/photo' + $scope.getReqParams(),
            method: 'POST',
            fileFormDataName: names,
            file: files
        });

Read more comments on GitHub >

github_iconTop Results From Across the Web

Only one file is uploaded when choosing multiple files in input ...
The way to fix this is for your users to ctrl/cmd+click each file they want while only opening the file explorer once. File...
Read more >
I need to add multiple files to my online application, but there ...
You can only upload 1 file per field. If you try to upload multiple files in the same field, only 1 (the last...
Read more >
Uploading multiple files - Manual - PHP
Multiple files can be uploaded using different name for input . It is also possible to upload multiple files simultaneously and have the...
Read more >
Solved: HubSpot Community - Uploading Multiple Files in Forms
Solved: Hi! I'm currently creating a form with the file upload feature and have selected to upload multiple files. However, when I go...
Read more >
Moodle in English: Upload of Multiple files
Try zipping the files/folders, uploading the zip file to Moodle, and unzipping from there. That should allow you to upload multiple files and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found