asp.Net   发布时间:2022-04-07  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了.NET中的FileUpload控件的使用-原生JS(二)大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

本篇使用原生JS进行数据传输,使用FileUpload控件上传文件,适配IE。

HTML

9381a90" class="code_img_closed" src="https://cn.js-code.com/res/2019/02-03/17/1c53668bcee393edac0d7b3b3daff1ae.gif" alt="">9381a90" class="code_img_opened" style="display: none" src="https://cn.js-code.com/res/2019/02-03/17/405b18b4b6584ae338e0f6ecaf736533.gif" alt="">
9381a90" class="cnblogs_code_hide">
 
=>
=> formenctype= id= multiple name= />

JS

https://cn.js-code.com/res/2019/02-03/17/1c53668bcee393edac0d7b3b3daff1ae.gif" alt="">https://cn.js-code.com/res/2019/02-03/17/405b18b4b6584ae338e0f6ecaf736533.gif" alt="">
{String} opt.type http 连接的方式 包括POST、GET {String} opt.url 请求的地址 {Boolean} async 是否异步 {object} otp.data 请求发出的数据 {Boolean} otp.contentType 传输中的数据格式 {Boolean} otp.processData 是否将数据序列化 {function} success 请求成功后的回调 {function} error 出错后的回调 { opt = opt ||{}; opt.method = (opt.method || ); opt.url = opt.url || opt. = opt. || false opt.contentType = opt.contentType || false; false,不修对象改格式 opt.processData = opt.processData || false;对数据对象做序列化操作 opt.data = opt.data ||{}; opt.success = opt.success ||{ }; opt.error = opt.error ||{ }; xmlhttp = httprequest) { xmlhttp = httprequest; } { xmlhttp = ActiveXObject(http); (opt.method.toUpperCase() === { xmlhttp.open(opt.method,opt.url,opt.);对数据做任何改变,有需要对数据格式进行处理的另当别论。 http.setrequestHeader('Content-Type','application/x-www-form-urlencoded;charest=utf-8'); http.send(opt.data); } (opt.method.toUpperCase()==={ xmlhttp.open(opt.method,opt.url + + opt.data,opt.); http.send(); xmlhttp.onreadystatechange ={ (xmlhttp.status == && xmlhttp.readyState == { success(xmlhttp.responseText); } { http.responseText); }

后台逻辑

https://cn.js-code.com/res/2019/02-03/17/1c53668bcee393edac0d7b3b3daff1ae.gif" alt="">https://cn.js-code.com/res/2019/02-03/17/405b18b4b6584ae338e0f6ecaf736533.gif" alt="">
{ files = request.Files.AllKeys.DisTinct(); (files != { (String each { httpPostedFileBase file = request.Files[each] httpPostedFileBase; httpPostedFileBase对象 (file != { InputFilename =ename(file.FileName); String str4 = AppDomain.CurrentDomain.baseDirectory; ServerSavePath = Path.Combine(Server.MapPath(); (!Directory.Exists(ServerSavePath)) { ); SavePath =Name); ); { false }

https://www.cnblogs.com/spadesQ/p/10300637.html">点我

感谢您的观看,您的

大佬总结

以上是大佬教程为你收集整理的.NET中的FileUpload控件的使用-原生JS(二)全部内容,希望文章能够帮你解决.NET中的FileUpload控件的使用-原生JS(二)所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: