uploadfile图片上传和ashx
|
uploadify.swf需要是支持中文 |
|
| $(function () { | |
| //获取所有上传按钮id | |
| $("div[id^='fileInput_']").each(function () { | |
| var name = $(this).attr("id"); | |
| create(name); | |
| }); | |
| }); | |
| function create(name) { | |
| var select = "上传图片"; | |
| if (name.indexOf("_") > -1) { | |
| if (name.substring(name.lastIndexOf("_") + 1) == "1") { | |
| var select = "大图"; | |
| } | |
| else if (name.substring(name.lastIndexOf("_") + 1) == "2") { | |
| select = "小图"; | |
| } | |
| } | |
| $('#' + name).uploadify({ | |
| 'uploader': '/uploadify/uploadify.swf', | |
| 'script': 'Pro_Sub.aspx?upfile=1', | |
| 'cancelImg': '/uploadify/cancel.png', | |
| 'folder': '/ProductImg/', | |
| 'fileExt': '*.jpg;*.gif;*.png;*.bmp;*.JPEG;', | |
| 'fileDesc': '请选择 *.jpg;*.gif;*.png,*.bmp;*.JPEG 格式的图片', | |
| 'multi': true, | |
| 'auto': true, | |
| 'buttonText':select, | |
| 'onComplete': function (event, queueId, fileObj, response, data) { | |
| var re = response.split('|@|'); | |
| if (re[0] == "1") { | |
| var box = name.substring(10); | |
| var html = "<div class='ImgHtml' OnClick='change(this)'><input class='input2' style='display: none;' type='button' value='删   除' onclick='delImg(this);showfi("+name.replace("_",".")+");' /><input type='checkbox' checked='checked' class='hide' value='" + re[1] + "' /><img class='Img' src='" + re[1] + "'></div>"; | |
| if (box == "1_0") { | |
| $("#ContentPlaceHolder1_rpAttribute_txtvalue_4").val(re[1]); | |
| html = "<div class='ImgHtml' OnClick='change(this)'><input class='input2' style='display: none;' type='button' value='删   除' onclick='delImg(this);showfi(1)' /><input type='checkbox' class='hide' value='" + re[1] + "' /><img class='Img' src='" + re[1] + "'></div>"; | |
| $("#file0").hide(); | |
| } | |
| $(".box" + box).append(html); | |
| } else { | |
| ymPrompt.errorInfo({ message: "上传失败!", showMask: true }); | |
| } | |
| } | |
| }); | |
| } | |
|
</script> ============================================================================= using System; using System.Web.SessionState; namespace Admin.TkAdmin.Product string upfile = Request["upfile"]; //对上传的图片进行保存到指定文件中 int rInt = ra.Next(1000); Session["IntIndexImg"] = rInt; newFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + rInt + Path.GetExtension(file.FileName).ToUpper(); }catch //用于创建目录 } public bool IsReusable |
uploadfile图片上传和ashx的更多相关文章
- thinkphp达到UploadFile.class.php图片上传功能
片上传在站点里是非经常常使用的功能.ThinkPHP里也有自带的图片上传类(UploadFile.class.php) 和图片模型类(Image.class.php).方便于我们去实现图片上传功能,以 ...
- CKEditor不借助CKFinder实现图片上传(.net版 ashx实现)
参考博客:http://blog.csdn.net/mydwr/article/details/8669594 本人版本:4.4.6 打开文件:ckeditor/plugins/image/dialo ...
- ashx 图片上传路径URL
ashx 图片上传 为了方便多出调用图片上传方法 首先我们将图片上传方法抽离出来 创建ashx 一个新的方法 using System; using System.Collection ...
- ashx 图片上传
为了方便多出调用图片上传方法 首先我们将图片上传方法抽离出来 创建ashx 一个新的方法 using System; using System.Collections.Generic; u ...
- ajax图片上传(asp.net +jquery+ashx)
一.建立Default.aspx页面 <%@ Page Language="C#" AutoEventWireup="true" CodeFile=&q ...
- plupload简易应用 多图片上传显示预览以及删除
<script> var uploader = new plupload.Uploader({ //实例化一个plupload上传对象 browse_button: 'btnBrowse' ...
- ASP.NET工作笔记之一:图片上传预览及无刷新上传
转自:http://www.cnblogs.com/sibiyellow/archive/2012/04/27/jqueryformjs.html 最近项目里面涉及到无刷新上传图片的功能,其实也就是上 ...
- ASP.NET图片上传和截取
一.介绍:图片的上传直接使用ajax就可以了,截取图片的话使用到Jcrop插件. 图片上传资料:https://www.jb51.net/article/87654.htm 截取图片插件:http:/ ...
- 对百度的UEditor多图片上传的一些补充
我已经写了一篇文章关于百度的UEditor提取多图片上传模块.如果还没有看过,请点击以下链接查看 http://www.cnblogs.com/luke1006/p/3719029.html 出差了两 ...
随机推荐
- 配置ngnix
server { listen ; server_name www.aaa.com; root /home/www/...; index index.php index.html index.htm; ...
- Apache curator-client详解
Apache curator框架中curator-client组件可以作为zookeeper client来使用,它提供了zk实例创建/重连机制等,简单便捷.不过直接使用curator-client并 ...
- CPU时间片
CPU时间片 为了提高程序执行效率,大家在很多应用中都采用了多线程模式,这样可以将原来的序列化执行变为并行执行,任务的分解以及并行执行能够极大地提高程序的运行效率. 但这都是代码级别的表现,而硬件是如 ...
- C#通过事件跨类调用WPF主窗口中的控件
xaml.cs文件: using System; using System.Timers; using System.Windows; using System.Windows.Forms; name ...
- Effective C++ -----条款55:让自己熟悉Boost
Boost 是一个社群,也是一个网站.致力于免费.源码开放.同僚复审的C++ 程序库开发.Boost 在C++ 标准化过程中扮演深具影响力的角色. Boost 提供许多TR1 组件实现品,以及其他许多 ...
- 模拟搭建Web项目的真实运行环境(三)
一.解决Redis出现的RDB权限问题 当你在安装redis的时候,如果是使用超级用户root安装, 开启redis服务的时候没有用超级用户去开启, 在用客户端登录redis,然后使用shutdown ...
- 与你相遇好幸运,Mongodb客户端&BUGS
> Robomongo https://robomongo.org > 日常使用频率最高的客户端 存在BUG: 在 db.getCollection('xzq').find({" ...
- 给Android系统安装busybox
转自:http://blog.csdn.net/lxgwm2008/article/details/38925051 busybox号称Linux平台的瑞士军刀,它集成了100多个最常用的Linux命 ...
- /var/run/yum.pid 已被锁定,PID 为 XXXX 的另一个程序正在运行。
安装st-load时, 终端提示 “/var/run/yum.pid 已被锁定,PID 为 13908 的另一个程序正在运行.” 解决方法:直接在终端运行 rm -f /var/run/yum.pid ...
- https
http://www.cnblogs.com/bugly/p/5075909.html# http://www.cnblogs.com/peijian708/archive/2011/05/07/20 ...