0

I'm trying to send file with params (using blueimp/jQuery-File-Upload) to my ASP.NET server, but it gives me only the last value of arr.

arr = [ 1, 2, 3 ]

$('#fileupload').fileupload({
  url: '/Upload?arr=' + arr+ ''
});

How can I send more than the last value?

Mr. Polywhirl
  • 42,981
  • 12
  • 84
  • 132
  • Maybe send them as: `'/Upload?' + arr.map(e => 'arr[]=' + e).join('&')`? See: https://stackoverflow.com/a/9547490/1762224 – Mr. Polywhirl Oct 01 '20 at 11:47
  • @Mr.Polywhirl doesnt woking but '/Upload?arr=' + arr.map(e => e).join(',') seems good – AskAlexandria Oct 01 '20 at 12:19
  • That doesn't make sense, because concatenating an array onto a string coerces it into a string joined by commas by default. What you have in necessary because the `map` call is self-returning... It's effectively `arr.join(',')` with extra steps. If what you say above works then I do not see how your original code does not work. – Mr. Polywhirl Oct 01 '20 at 12:44

0 Answers0