How can i select images from brows file input without lost previously selected file? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can i select images from brows file input without lost previously selected file?

I am trying so many way but I am not solving by used simple browse file input please sugest me

29th Mar 2017, 6:06 PM
Vijay Chauhan
Vijay Chauhan - avatar
12 Answers
+ 10
Wildly guessing since I do not see your code, add each selected file to an array.
29th Mar 2017, 7:32 PM
Kirk Schafer
Kirk Schafer - avatar
+ 9
I am a little unclear what you're doing, but I've seen job websites handle multiple-select uploads (since people can upload CV/résumé, cover letter and certs) by immediately uploading each selection into a 'holding area' on the site. I believe that's because the file-selector is one-shot. Perhaps to get around the confusion of telling people how to multiselect (hold down Control...? I'll have to check), they separate the file uploads from the form...you submit the form when all the uploads are already done. If you must use multipart upload...I'd actually like to see that part of your code (I may be missing something). It won't work on SoloLearn, but I can test locally.
29th Mar 2017, 8:01 PM
Kirk Schafer
Kirk Schafer - avatar
+ 9
Just the client bit is fine. One way that works really well is for samples to be 'just the part that isn't working' (so the minimum sample), and then that goes on: https://pastebin.com and you share the link. Possible?
29th Mar 2017, 8:12 PM
Kirk Schafer
Kirk Schafer - avatar
+ 9
I've stripped your code to a small working sample. Does it (nearly) duplicate the behavior you're seeing? https://jsfiddle.net/6ayak3pb/1/ <input type='file'> is one-shot. You have to select all the files at once. If you click it again you get a new batch. For proof, see someone who did what you're doing, for IE: https://www.raymondcamden.com/2013/09/10/Adding-a-file-display-list-to-a-multifile-upload-HTML-control Important difference: they clear the upload queue (the div)...because: the queue is one-shot. If you want to submit each batch as selected, people historically use jQuery/XHR/AJAX. The new way is fetch(): http://stackoverflow.com/questions/36067767/how-do-i-upload-a-file-with-the-html5-js-fetch-api First answer: http://stackoverflow.com/a/36082038 I have a 'read' fetch sample here (another use + reference): https://code.sololearn.com/WWB9eLU9rcxG/?ref=app If none of this helps you, we can look at the fiddle. Just for the record: To do a multiselect on: PC's/Apple: Ctrl-click or shift-click in file explorer Android: (built-in explorer) tap and HOLD until "1 file selected" appears. Tap on additional files and then [Open]. If needed, test different browsers in a virtual Windows box at https://www.browserling.com ; use the above fiddle and when you click [Choose Files] you'll get Windows Explorer to select images from the default user's "Shared Pictures".
31st Mar 2017, 12:21 AM
Kirk Schafer
Kirk Schafer - avatar
+ 2
yes it is adding but when execute for upload that file that is upload last selected file and rest of file skipped because multiinput on the time of file selection reset previous selected file., so if you have please shared your code
29th Mar 2017, 7:36 PM
Vijay Chauhan
Vijay Chauhan - avatar
+ 2
yes I sent to you by tomorrow if possibly you can shared your email here then I sent to directly whole part or server url that all code in php,js
29th Mar 2017, 8:05 PM
Vijay Chauhan
Vijay Chauhan - avatar
+ 2
thanks for your replies
29th Mar 2017, 8:06 PM
Vijay Chauhan
Vijay Chauhan - avatar
+ 2
ok
29th Mar 2017, 8:13 PM
Vijay Chauhan
Vijay Chauhan - avatar
+ 2
Hi Kirk , please review the code on below link https://pastebin.com/GTwTSbgS
30th Mar 2017, 10:18 AM
Vijay Chauhan
Vijay Chauhan - avatar
+ 2
we have selected file many times from different location then i have upload the selected files then it upload only last time selected file can you please check the same. Thank you
30th Mar 2017, 10:20 AM
Vijay Chauhan
Vijay Chauhan - avatar
+ 2
thank you very much for jsfiddel is working
1st Apr 2017, 9:35 AM
Vijay Chauhan
Vijay Chauhan - avatar
+ 2
I appreciate your answers
1st Apr 2017, 9:35 AM
Vijay Chauhan
Vijay Chauhan - avatar