当前位置: 首页 > news >正文

.Net Core上传组件_.Net Core图片上传组件_Uploader7.0

一、.Net Core上传组件Uploader7.0简介

1.当前版本v7.0,前端框架丰富升级

2.前端jquery框架封装,cover.js, 腾讯云cos-js-sdk-v5.min.js

3.后端,支持Asp.Net 和 Asp.Net Core 矿建

4.数据传输模式支持:WebScoket 、Ajax、Form 模式上传到服务器。

最新版本资料请参考官网:uploader上传控件介绍 - 微工具集

二、后端安装,前端引入,参考之前文章:.Net Core上传组件_.Net Core图片上传处理组件_uploadcore_天马3798的博客-CSDN博客

提醒:安装v6.0或者v.5.0系列

三、配置使用说明

1.type ,控件类型

type: 'single',//控件类型
/*
* 1.简单形式(single,单纯上传文件,自动提交)
* 2.对话框形式(dialog,需要图片剪切处理)
* 3.前台压缩,大小图片上传 (imgdouble) :不改变原图片的比例,在指定范围内等比例缩放,小图(minWidth*minHeight); 大图((maxWidth*maxHeight))
* 4.前台最大比例,图片处理(fixedsize):固定比例缩放,最大化图片显示,剩余空间填充空白
* 5.前台最大比例,图片剪切(fixedcut):固定比例缩放(maxWidth*maxHeight),最大化图片剪切
* 6.前台裁剪,大小图处理(cutdouble):固定最小图(minWidth*minHeight),最大图(maxWidth*maxHeight),裁剪图片
* 7.前端压缩,图片上传(imgsingle):不改变图片的比例,在指定范围内等比例缩放,小图(minWidth*minHeight); 大图((maxWidth*maxHeight))
*/

2.uploadType,上传协议类型

 uploadType: 1,//上传处理方式

1-----Ajax上传处理(默认)  

2----WebSocket上传处理(主要用于应对单文件上传)

 3----tencent 腾讯云上传模式

3.其他参数:

subfolder: '',//指定后台保存的子文件夹
more: false, //是否支持多个文件;默认 0不支持多个文件上传,2;支持多个文件上传,但是是一个一个的; 3:支持多文件多连接上传
moreCount:5,//最多支持上传个数
debug: false, //如果是调试模式,指定输出内容

maxWidth: 1960,//前台压缩时,最大宽度
maxHeight: 1000,//前台压缩时,最大高度
minWidth: 300,//前台压缩时,最小宽度
minHeight: 300,//前台压缩时,最小高度
background: 'white',// 在使用到背景处理时的,默认背景
tempFile: uploadCfg.tempFile,//设置临时文件夹
auto: true,//是否自动上传文件
isImg: false,//是否是图片,如果是图片提供预览功能
quality:0.8,//默认导出图片质量大小 0-1
fileExts: 'jpg;png;gif;bmp;jpeg',//允许上传的文件扩展名,*----没有显示
timeout: 30000,

四、使用案例整理,常见6打场景

1.简单文件上传,single

    /*******使用WebScoket 方式处理传输*******/var uploader = $('#uploadBtn').uploader({url: 'ws://' + location.host + '/upload/common',fileExts:'*',text: '简单上传按钮',maxSize:1024*1024*1000,more:true,debug:true,onSuccess: function (data) {console.info(data);$('#name').text(data.newName);$('#relativeName').text(data.relativeName);}});

2.图片压缩上画攒+不改变图片比例,imgsingle

        /*******使用WebScoket 方式处理传输*******/var uploader = $('#uploadBtn').uploader({url: 'ws://' + location.host + '/upload/common',fileExts:'jpg;png;gif;jpeg',text: '图片上传按钮',type:'imgsingle',maxSize:1024*1024*1000,more:true,//isImg:true,debug:true,maxWidth: 1200,maxHeight: 1200,onSuccess: function (data) {console.info(data);$('#name').append('<div>'+data.newName+'</div>');$('#relativeName').append('<div>'+data.relativeName+'</div>');$('#result').append('<img src="'+data.relativeName+'" />')}});

3.固定大小图片上传+裁剪图片,fixedcut

    /*******使用WebScoket 方式处理传输*******/var uploader = $('#uploadBtn').uploader({url: 'ws://' + location.host + '/upload/common',fileExts:'jpg;png;gif;jpeg',text: '图片上传按钮',type:'fixedcut',maxSize:1024*1024*1000,more:true,//isImg:true,debug:true,maxWidth: 200,maxHeight: 200,onSuccess: function (data) {console.info(data);$('#name').append('<div>'+data.newName+'</div>');$('#relativeName').append('<div>'+data.relativeName+'</div>');$('#result').append('<img src="'+data.relativeName+'" />')}});

4.大小图上传+不改变图片比例,imgdouble

    /*******使用WebScoket 方式处理传输*******/var uploader = $('#uploadBtn').uploader({url: 'ws://' + location.host + '/upload/common',fileExts: "jpg;png",text: '选择图片',maxSize: 1024 * 1024 * 1000,more: true,debug: true,type: "imgdouble",minWidth: 100,minHeight: 100,maxWidth: 1200,maxHeight: 1200,onSuccess: function (data) {console.info(data);var small = data.small;var big = data.big;$('#imgSmallInfo #name').text(small.newName);$('#imgSmallInfo #relativeName').text(small.relativeName);$('#imgSmallInfo img').attr('src', small.relativeName);$('#imgBigInfo #name').text(big.newName);$('#imgBigInfo #relativeName').text(big.relativeName);$('#imgBigInfo img').attr('src', big.relativeName);}});

5.大小图上传+裁剪图片压缩,cutdouble

    /*******使用WebScoket 方式处理传输*******/var uploader = $('#uploadBtn').uploader({url: 'ws://' + location.host + '/upload/common',fileExts: "jpg;png",text: '选择图片',maxSize: 1024 * 1024 * 1000,more: true,debug: true,type: "cutdouble",minWidth: 100,minHeight: 100,maxWidth: 1200,maxHeight: 1200,onSuccess: function (data) {console.info(data);var small = data.small;var big = data.big;$('#imgSmallInfo #name').text(small.newName);$('#imgSmallInfo #relativeName').text(small.relativeName);$('#imgSmallInfo img').attr('src', small.relativeName);$('#imgBigInfo #name').text(big.newName);$('#imgBigInfo #relativeName').text(big.relativeName);$('#imgBigInfo img').attr('src', big.relativeName);}});

6.选择裁剪图片上传,dialog

        /*******使用WebScoket 方式处理传输*******/var uploader = $('#uploadBtn').uploader({url: 'ws://' + location.host + '/upload/common',fileExts:'jpg;png;gif;jpeg',text: '图片上传按钮',type:'dialog',maxSize:1024*1024*1000,more:false,debug:true,coverParams: {title:'选择头像',targetWidth:300,targetHeight:300},onSuccess: function (data) {console.info(data);$('#name').text(data.newName);$('#relativeName').text(data.relativeName);$('img').attr('src',data.relativeName)}});

7.上传腾讯云(内部使用,了解更多添加微信:tianma104,私聊)

    /*******使用tencent 方式处理传输 视频 mp4*******///不需要指定上传路径var uploader = $('#uploadBtn').uploader({fileExts: 'mp4',text: '视频上传按钮',type: 'single',maxSize: 1024 * 1024 * 1000,more: false,debug: true,uploadType: 3,//使用腾讯云方式//oldFileName: '1677044999702-35.mp4',  // 重点指定就的视频文件名,可以执行远程删除任务oldFileName:'',onSuccess: function (data) {console.info(data);$('#name').text(data.newName);$('#relativeName').text(data.absoluteName);$('video').attr('src', data.absoluteName)}});

更多:

.Net Core上传组件_.Net Core图片上传处理组件

Asp.Net Core WebSocket绑定

删除github上的远程分支

http://www.lryc.cn/news/99905.html

相关文章:

  • Exadata磁盘损坏导致磁盘组无法mount恢复(oracle一体机磁盘组异常恢复)---惜分飞
  • 左值引用与右值引用的区别?右值引用的意义?
  • 2023年深圳杯数学建模D题基于机理的致伤工具推断
  • Vue的router学习
  • Inpaint Anything: 自动化抹除视频元素
  • Flutter 开发者工具 Android Studio 开发Flutter应用
  • 后端byte[]传给前端接收默认变成string字符串
  • UE5 动画蓝图模板(Animation Blueprint Template)
  • Log4j源码解析
  • Docker 容器访问宿主机服务
  • Go 发送邮件
  • Spring AOP 的概念及其作用
  • python基础1——环境安装
  • uniapp 中 的progress加载进度条 的使用,在 页面显示数据加载的进度条,使用户的使用体验效果更好
  • 【尚硅谷】第01章:随堂复习与企业真题(Java语言概述)
  • MyBatis的SqlSession理解
  • axios 某个接口使用自己独有的完整地址
  • WEB:Web_python_template_injection
  • 【Android安全】Embedded Trace Microcell模块
  • 修改内核驱动之后-如何给内核打补丁
  • 【javaSE】 类和对象详解
  • 大数据课程D5——hadoop的Sink
  • 【数据结构】27.移除元素
  • 机器学习分布式框架ray运行xgboost实例
  • C++设计模式笔记
  • 简单聊聊创新与创造力
  • 使用TensorFlow训练深度学习模型实战(上)
  • 【Spring】什么是Bean的生命周期及作用域,什么是Spring的执行流程?
  • 立创EDA学习
  • 清风学习笔记—层次分析法—matlab对判断矩阵的一致性检验