Ver Fonte

fix img upload

huai-sian há 3 anos atrás
pai
commit
d13177b2de
1 ficheiros alterados com 4 adições e 0 exclusões
  1. 4 0
      html/static/script_util.js

+ 4 - 0
html/static/script_util.js

@@ -149,9 +149,12 @@ function openavatarModel() {
   avatarModal.show();
 }
 
+
 $('input[type=file]').on('change', prepareUpload);
+$('.upload-btn').change(prepareUpload);
 function prepareUpload(event) {
   files = event.target.files;
+  $(this).prev().val('');
   var data = new FormData();
   //data.append('file', $('.img_up1').prop('files')[0]);
   data.append('file', files[0]);
@@ -532,6 +535,7 @@ function load_data(tid, loaded_data, draft = false) {
       imguploadlabel.textContent = 'Upload';
     }
     imguploadlabel.setAttribute('set-lan', `html:upload_file`);
+    $('input[type=file]').on('change', prepareUpload);
     imgInputs.appendChild(imguploadlabel);
   }
    setTimeout(() => {