Locally, the uploaded pictures will be converted to Base64 code and saved to an array, and the same files cannot be added continuously.

locally, the uploaded image is converted to Base64 code and saved to an array, and the same file cannot be added continuously. At this time, if you add another picture, you will have no problem if you add it back to the previous one.

    <input  type="file" name="file" class="jokeFile" value="" id="addUppLoadFile" onChange="addUploadInvoice()" accept="image/*">
     

window.addUploadInvoice = ()=>{
    let ffval = $("-sharpaddUppLoadFile").val();
    if(!/.(jpg|jpeg|png|bmp)$/.test(ffval)){
        commonModule.showAlertTips("jpgjpegbmppng")
        return false;
    }

    let addfile = document.getElementById("addUppLoadFile").files[0];
    let rWind = new FileReader();  //
    rWind.onload = function(){
        addModalVm.localImgList.push(rWind.result);
        console.log(addModalVm.localImgList.length)
    }
    rWind.readAsDataURL(addfile);
}
Mar.09,2021
Value was emptied when

onChange= "addUploadInvoice ()" . Then you can choose the same file. No. Otherwise, the same file will not trigger change


instead of onClick

Menu