Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skipper:Skipper ignores upstreams whose param names end in "[]" #4702

Open
vinhtq opened this issue Feb 27, 2015 · 13 comments
Open

Skipper:Skipper ignores upstreams whose param names end in "[]" #4702

vinhtq opened this issue Feb 27, 2015 · 13 comments
Labels
bug try this out please uploads Related to file uploads (sails-hook-uploads, skipper, skipper adapters, streaming, transloading,etc)

Comments

@vinhtq
Copy link

vinhtq commented Feb 27, 2015

When i try to upload one file, everything is ok!
But when i upload multiples, skipper does not work! I think because the upload try to use array in their param, so skipper does not understand!

Here is the code:
HTML:

<form enctype="multipart/form-data" action="post_upload.php" method="POST">
<input type="file" name="file[]" multiple />
<input type="submit" name="upload" value="Upload" />
</form>

Sailsjs:

req.file('files').upload(function (err, uploadFiles) {
console.log(uploadFiles.length);
});

The log always give the 0 result

@RSSGergelyMunkacsy
Copy link

I think you need to use file key instead of filesin Sailjs.

@vinhtq
Copy link
Author

vinhtq commented Mar 3, 2015

Sorry for this mistake!
But i still cannot upload if i change the name to file instead of files
Could you please take a look at this issues:
https://github.com/balderdashy/skipper/issues/63

@RSSGergelyMunkacsy
Copy link

Sorry, I have no time for digging into it correctly, but for me, this is work correctly:

[Create.hbs]
<input class="form-control uniform_on" id="uploadImages" name="image" type="file" multiple>
[SomeController.js]
req.file('image').upload({dirname: uploadDir}, function onUploadComplete(err, uploadedImages) {
      if (!!err) {
        return callback(err, null);
      }

So I don't use [] in the input name, the skipper handle it for me and in the uploadedImages I get an array of images.

@vinhtq
Copy link
Author

vinhtq commented Mar 4, 2015

Thank you for you response!
But you cannot force people to do that because it works on php if you use [] in the input!
My problem is the same, i use dropzonejs. Dropzonejs automatically add [] to the input name
when i upload multiple files!

<form action="file-upload.php" method="post" enctype="multipart/form-data" multiple>
  <input name="userfile[]" type="file" /><br />
  <input type="submit" value="Send files" />
</form>

Above code works in php, so why not sailsjs?

I think skipper should fix this bug!

@sailsbot
Copy link

Thanks for posting, @vinhtq. I'm a repo bot-- nice to meet you!

It has been 60 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message. On the other hand, if you are still waiting on a patch, please:

  • review our contribution guide to make sure this submission meets our criteria (only verified bugs with documented features, please; no questions, commentary, or bug reports about undocumented features or unofficial plugins)
  • create a new issue with the latest information, including updated version details with error messages, failing tests, and a link back to the original issue. This allows GitHub to automatically create a back-reference for future visitors arriving from search engines.

Thanks so much for your help!

@mrcarl79
Copy link

mrcarl79 commented Dec 4, 2015

This is a problem for me also as ng-file-upload passes the files as an array like this, but it gets ignored in skipper/sailsjs. Any thoughts?

------WebKitFormBoundaryWCbq6JPGGudQoBmR
Content-Disposition: form-data; name="file[0]"; filename="full_13246-w1000h0.jpg"
Content-Type: image/jpeg

------WebKitFormBoundaryWCbq6JPGGudQoBmR
Content-Disposition: form-data; name="file[1]"; filename="full_13284-w1000h0.jpg"
Content-Type: image/jpeg

@mrcarl79
Copy link

mrcarl79 commented Dec 4, 2015

Just done a typical spend hours trying to fix something then 5 minutes after posting about it I fix it lol

If anyone has my same issue put an arrayKey: '' property in the ng-file-upload config like this:

Upload.upload({
url: 'http://localhost/upload',
arrayKey: '',
data: {
file: files
}
});

Then it works ok with sailsjs :)

@ram-you
Copy link

ram-you commented Apr 26, 2016

@mrcarl79 Thank you very very much. You and the arrayKey: '' saved my life.

@mikermcneil
Copy link
Member

@mrcarl79 thanks for posting that!

@vinhtq @RSSGergelyMunkacsy @ram-you @mrcarl79 Would love to merge a patch for this, but in the mean time I'm going to reopen this issue and change the title to clarify that this is an issue related to field name, so we have this tracked. See https://twitter.com/mikermcneil/status/806286981856710656 and https://gitter.im/balderdashy/sails?at=58475141bc32453c289d5e9a for reference.

@mikermcneil mikermcneil reopened this Dec 7, 2016
@mikermcneil mikermcneil changed the title Problem with upload multiple files Skipper ignores upstreams whose param names end in "[]" Dec 7, 2016
@mukk85
Copy link

mukk85 commented May 15, 2017

Any progress on this issue?

@gopalkohli
Copy link

@mrcarl79 +1

@raqem raqem transferred this issue from sailshq/skipper Mar 18, 2019
@balderdashy balderdashy deleted a comment from sailsbot Mar 18, 2019
@raqem raqem changed the title Skipper ignores upstreams whose param names end in "[]" Skipper:Skipper ignores upstreams whose param names end in "[]" Mar 18, 2019
@raqem
Copy link
Contributor

raqem commented Mar 18, 2019

Hi @vinhtq, @RSSGergelyMunkacsy, @mrcarl79, @ram-you
Just letting everyone know we are consolidating all the open Sails issues into one repo.
~Cheers!

@johnabrams7 johnabrams7 added the uploads Related to file uploads (sails-hook-uploads, skipper, skipper adapters, streaming, transloading,etc) label Mar 19, 2019
@johnabrams7
Copy link
Contributor

johnabrams7 commented Apr 16, 2019

@vinhtq @RSSGergelyMunkacsy @mrcarl79 @mukk85 @ram-you @forestallers - Sails v1.1.0 has many updates for skipper. There's also a skipper edge version 0.9.0-4 that was released 3 months ago for further testing. Has anyone tested this out with the latest Sails v1.1.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug try this out please uploads Related to file uploads (sails-hook-uploads, skipper, skipper adapters, streaming, transloading,etc)
Development

No branches or pull requests

10 participants