layui multiple file upload control codes to reduce integration

 

 

 

// upload pictures 
  upload.render ({
    elem: '.upload-img' // Click the Upload button in the use of such unity 
    , url: "{: url ( 'Image / the Upload')}" 
    , DONE: function (RES, index, the Upload) {
       // Get the current upload trigger element, may be used when the class elem binding Note: This is layui 2.1.0 new 
      var Item = the this .Item;
       // if the upload has failed 
      IF (res.status == 0 ) {
        layer.msg ( 'failed to upload', icon {:}. 5); // failure expression 
      }
       // uploaded successfully 
      layer.msg (res.message, {
          icon: . 6, // successful expression 
          Time: 2000 // 2 seconds off (if not configured, the default is 3 seconds) 
        }, function () {
          item.nextAll('div').find('img').attr('src', res.data.img_url);
          item.prev().val(res.data.img_url);
        }); 
    }
  })

 

 

 

 

 

 

1

Guess you like

Origin www.cnblogs.com/Skate0rDie/p/11163937.html