这次给大家带来jQuery.Uploadify插件实现有进度条批量上传图片功能,jQuery.Uploadify插件实现有进度条批量上传图片的注意事项有哪些,下面就是实战案例,一起来看一下。
Jquery $(document).ready(function () { $("#pics").hide(); $("#uploadify").uploadify({ 'uploader': 'js/jquery.uploadify-v2.1.4/uploadify.swf', //uploadify.swf文件的路径 'script': 'UploadHandler.ashx?type=add', //处理文件上传的后台脚本的路径 'cancelImg': 'js/jquery.uploadify-v2.1.4/cancel.png', 'buttonText': 'Select Image', 'folder': 'UploadFile//', //上传文件夹的路径按20130416 'queueID': 'fileQueue', //页面中,你想要用来作为文件队列的元素的id 'auto': false, //当文件被添加到队列时,自动上传 'multi': true, //设置为true将允许多文件上传 'fileExt': '*.jpg;*.gif;*.png', //允许上传的文件后缀 'queueSizeLimit': 5, 'fileDesc': 'Web Image Files (.JPG, .GIF, .PNG)', //在浏览窗口底部的文件类型下拉菜单中显示的文本 'sizeLimit': 1024000, //上传文件的大小限制,单位为字节 1024*1000 1M 'onComplete': function (event, queueID, fileObj, response, data) { var html = ""; html += "

登录后复制
using System;using System.Web;using System.IO;////// UploadHandler文件上传/// public class UploadHandler : IHttpHandler{ public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Charset = "utf-8"; string type = context.Request["type"]; if (type=="add") { HttpPostedFile file = context.Request.Files["Filedata"]; string uploadPath = HttpContext.Current.Server.MapPath(@context.Request["folder"]); string name = context.Request.Params["name"]; //获取传递的参数 string albums = context.Request.Params["albums"]; if (file != null) { if (!Directory.Exists(uploadPath)) { Directory.CreateDirectory(uploadPath); } file.SaveAs(Path.Combine(uploadPath, file.FileName)); context.Response.Write(@context.Request["folder"] + file.FileName); } else { context.Response.Write(""); } } else if (type == "del") { string picurl = context.Request["picurl"]; try { File.Delete(context.Server.MapPath(picurl)); context.Response.Write(picurl); } catch { context.Response.Write(""); } } else { } } public bool IsReusable { get { return false; } }}
登录后复制
相信看了本文案例你已经掌握了方法,更多精彩请关注【创想鸟】其它相关文章!
推荐阅读:
Uploadify实现显示进度条上传图片
悬浮链接弹出图片特效实现
以上就是jQuery.Uploadify插件实现有进度条批量上传图片功能的详细内容,更多请关注【创想鸟】其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2767655.html