0

I'm working on some automated process. My current requirement is to upload files one by one in a particular directory to server through AJAX. This process should start when I called its function.

How can I achieve it?(javascript,jquery,BackEnd:C#,WebApi)

Alexandre Neukirchen
  • 2,713
  • 7
  • 26
  • 36
ArunKumar
  • 63
  • 1
  • 1
  • 9
  • 2
    If the files are on the client machine it's not possible. If it was it would be a *massive* security flaw. – Rory McCrossan Dec 08 '16 at 14:41
  • It is possible without a fileupload control (event.dataTransfer) yet not without any user interaction. – Lain Dec 08 '16 at 14:43
  • @Rory,Yes,it is in the client machine..is there any other way to automate it?this is a part of an automated process,and i dont want user to choose files one by one or allow him to multiselect !!is there any possibilities? – ArunKumar Dec 08 '16 at 14:44
  • 2
    No there is no way. And never will be. If it were, you can read people their directories without authorization. – Timmetje Dec 08 '16 at 14:45
  • @Lain may i have any sample code pls? – ArunKumar Dec 08 '16 at 14:45
  • His sample is also with user selection / interaction. It is not possible. – Timmetje Dec 08 '16 at 14:46
  • @ArunKumar: It wont help you for your case. – Lain Dec 08 '16 at 14:46
  • Multiselect or uploading directories is possible tho - with both ways. – Lain Dec 08 '16 at 14:46
  • @Timmetje ok,then i looking answer for a wrong question,is there any workaround for it by using fileupload control events using jquery? – ArunKumar Dec 08 '16 at 14:46
  • @Lain..Ok Lain..Anyway..i have a clear shot with all of ur answers – ArunKumar Dec 08 '16 at 14:48
  • The event still has to be fired by a user actually selecting files in a file selection tool or drag and drop. See https://www.w3.org/TR/file-upload/ or https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer – Timmetje Dec 08 '16 at 14:49
  • Possible duplicate of [Javascript file uploads](http://stackoverflow.com/questions/408735/javascript-file-uploads) – MoeSattler Dec 08 '16 at 15:05

0 Answers0