javascript - Input file upload multiple files not working on Mobile device -
i have generic file loader looks this:
<span class="input-group-btn"> <span class="btn btn-default btn-fill btn-file"> browse<input type="file" id="fileinputs" multiple accept="image/*" onclick="resetprogresss()"> </span> </span>
i can upload multiple files desktop no problems, when try , use same functionality on mobile device, cannot seem select multiple files.
here javascript:
var filenames; function generateuuid() { var d = new date().gettime(); var uuid = 'xxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = (d + math.random() * 16) % 16 | 0; d = math.floor(d / 16); return (c == 'x' ? r : (r & 0x3 | 0x8)).tostring(16); }); return uuid; }; var mainpath = generateuuid(); var names = []; function uploadfiles() { var setdir = mainpath; var fileinputs = document.getelementbyid("fileinputs"); if ('files' in fileinputs) { if (fileinputs.files.length == 0) { alert("please select file"); return; } else { var file = fileinputs.files[0]; var ar = $("#autoresumeboxs").is(":checked"); var chunksize = 20000; var name = setdir; /* arguments: username name used create subfolders on server. files files object file input tag. uploadstartfunction function receives file object before uploading. progressfunction function accepts percent-complete integer value. donefunction function called when file uploaded. errorfunction function called when error occurs. chunksize size in bytes of each chunk uploaded. autoresume bool control auto resuming. */ cfupload(name, fileinputs.files, uploadstarts, progresss, dones, errors, chunksize, ar); } } } function uploadstarts(thisfile) { names.push(thisfile.name); } function progresss(percent) { var p = percent + "%"; $("#lblups").text(p); $("#progressbars").width(p); $("#progressbars").attr("data-appear-progress-animation", p); $("#progresstabs").text(p); } function resetprogresss() { progresss(0); } function dones() { } function errors(data) { } function setcookie(c_name, value, exdays) { var exdate = new date(); exdate.setdate(exdate.getdate() + exdays); var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toutcstring()); document.cookie = c_name + "=" + c_value; } function getcookie(c_name) { var c_value = document.cookie; var c_start = c_value.indexof(" " + c_name + "="); if (c_start == -1) { c_start = c_value.indexof(c_name + "="); } if (c_start == -1) { c_value = null; } else { c_start = c_value.indexof("=", c_start) + 1; var c_end = c_value.indexof(";", c_start); if (c_end == -1) { c_end = c_value.length; } c_value = unescape(c_value.substring(c_start, c_end)); } return c_value; } $(document).ready(function () { $("#urls").hide(); document.getelementbyid("saveme").disabled = true; var username = getcookie("username"); });
i use library upload files. advice appreciated.
well depends on selection method choose on mobile , , native gallery , , file manager absloutely work fine on mobile , tap , hold file want upload , , switch multi selection mode :
please note there many jquery plugins out there upload files this one , not necessary use pure html input tag.
Comments
Post a Comment