Open vinhtq opened 9 years ago
I think you need to use file
key instead of files
in Sailjs.
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
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.
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!
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:
Thanks so much for your help!
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
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 :)
@mrcarl79 Thank you very very much. You and the arrayKey: ''
saved my life.
@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.
Any progress on this issue?
@mrcarl79 +1
Hi @vinhtq, @RSSGergelyMunkacsy, @mrcarl79, @ram-you Just letting everyone know we are consolidating all the open Sails issues into one repo. ~Cheers!
@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?
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:
Sailsjs:
The log always give the 0 result