C#-图片上传
2021-04-30 00:29
标签:app catch ESS post ack image 图片处理 nba NPU C#-图片上传: controller: service层: HTML: JavaScript: C#-图片上传 标签:app catch ESS post ack image 图片处理 nba NPU 原文地址:https://www.cnblogs.com/nanxixi/p/14715152.html 1 public JsonResult ExpressDeliverySign(ExpressDeliverySign_LO_IP model)
2 {
3 HttpFileCollectionBase files = Request.Files;
4 if (files != null && files.Count > 8)
5 return Json(new RetMsgM() { Success = false, Message = "限制最多上传八张图片" });
6
7 List
1 public RetMsgM ExpressDeliverySign(ExpressDeliverySign_LO_IP model, List
1 div class="form-group">
2 label class="control-label">上传图片:label>
3 div class="input-group input-group-sm">
4 button type="button" class="layui-btn" id="btnFirst">上传图片button>
5 (span style="font-size: 10px; color: red;">限制最多上传四张span>)
6 span id="ErrorMsg">span>
7 div>
div>
1 layui.use(‘upload‘, function () {
2 var $ = layui.jquery;
3 var upload = layui.upload;
4 var uploadInst = upload.render({
5 elem: ‘#btnFirst‘,
6 multiple: true,
7 auto: false,
8 accept: ‘file‘,
9 choose: function (obj) {
10 uploadInst.config.elem.next()[0].value = ‘‘;
11 $.upload.files = obj.pushFile();
12 //var files = this.files = obj.pushFile();
13 obj.preview(function (index, file, result) {
14
15 var imageUrl = result;
16 $.upload.uploadImages.push(file.name);
17 if ($.upload.uploadImages.length > 4) {
18 //删除文件
19 delete $.upload.files[index];
20 //获取数组的下标
21 var indexs = $.upload.uploadImages.indexOf(file.name);
22 $.upload.uploadImages.splice(indexs, 1);
23 $.msg.warning("限制最多上传四张图片!");
24 return false;
25 } else if (file.size > 10 * 1024 * 1024) {
26 //删除文件
27 delete $.upload.files[index];
28 //获取数组的下标
29 var indexs = $.upload.uploadImages.indexOf(file.name);
30 $.upload.uploadImages.splice(indexs, 1);
31 $.msg.warning("限制上传文件最大10M!");
32 return false;
33 } else {
34 var divImageNum = "img" + $.upload.uploadImages.length;
35 $("#uploadImage").append(`
36
上一篇:window批处理清空垃圾