Home  >  Article  >  Web Front-end  >  Share how to use layui upload component

Share how to use layui upload component

小云云
小云云Original
2018-03-05 16:42:262109browse

This article mainly shares with you how to use the layui upload component. First, paste the front-end code. I hope it can help everyone.


    产品特性Form
    
    
    
    
    
    

        

                      

            

                                                                                                                             
文件名大小状态操作
          

                   

      

    

C#Backend receiving code

HttpFileCollection hfc = System.Web.HttpContext.Current.Request.Files;string str1 = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;string imgPath = "";string fileName = "";fileName = hfc[0].FileName;imgPath = Server.MapPath("~/bin/" + fileName);imgPath = Server.MapPath("~/bin/" + modelId + "/" + productid + "/" + nodeid + "/" + filetype + "/" + fileName);hfc[0].SaveAs(imgPath);return Content(new AjaxResult { Status = ResultType.success, Message = "执行成功" }.ToJson());

What you need to pay attention to during specific use is
auto: false
bindAction: '#testListAction'
These two This parameter is mainly set to not upload files when you select files, but to specify a button to perform the upload action.
Assuming that you need to perform the upload action when you select a file, you only need to set auto to true and remove bindAction. This parameter

Other parameters can refer to the layui official website documentation

There are many things that need to be judged when uploading files. I just record an example to facilitate your future use.

Related recommendations:

layui.js form verification function example sharing

detailed explanation of vue Alibaba Cloud upload component

Introduction to common methods of jQuery layui

The above is the detailed content of Share how to use layui upload component. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn