Home > Article > Web Front-end > Share how to use layui upload component
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!