Uploadify jquery+falsh+UploadHandler.ashx
官方网:http://www.uploadify.com/ 只有PHP版本
对于我们.net的来说是一个遗憾!现在奉献一个c#版本,希望对大家有用。
看代码其实很简单,在做这个之前遇到许多问题,特别是在IHttpHandler 里面,只有经历过了才会体会到,还是给解决了!
直接运行html出现下面错误 要在vs运行下才没有下面错误
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns="http://www.w3.org/1999/xhtml">
< head >
< meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
< title >Uploadify</ title >
< link href="css/default.css" rel="stylesheet" type="text/css" />
< link href="css/uploadify.css" rel="stylesheet" type="text/css" />
< script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></ script >
< script type="text/javascript" src="scripts/swfobject.js"></ script >
< script type="text/javascript" src="scripts/jquery.uploadify.v2.1.0.min.js"></ script >
< script type="text/javascript">
$(document).ready(function() {
$("#uploadify").uploadify({
'uploader' : 'scripts/uploadify.swf',
'script' : 'scripts/UploadHandler.ashx',
'cancelImg' : 'scripts/cancel.png',
'folder' : 'uploads',
'queueID' : 'fileQueue',
'sizeLimit' : '5242880',//5M
'auto' : false,
'multi' : true ,
'onError' : function (a, b, c, d)
{
if (d.status == 404)
alert('Could not find upload script. Use a path relative to: '+'<?= getcwd() ?>');
else if (d.type === "HTTP")
alert('error '+d.type+": "+d.status);
else if (d.type ==="File Size")
alert(c.name+' '+d.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB');
else
alert('error '+d.type+": "+d.info);
}
});
});
</ script >
</ head >
< body >
< div id="fileQueue"></ div >
< input type="file" name="uploadify" id="uploadify" />
< p >
< a href="javascript:$('#uploadify').uploadifyUpload()">Upload</ a >|
< a href="javascript:$('#uploadify').uploadifyClearQueue()">Cancel All Uploads</ a >
</ p >
</ body >
</ html >
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<%@ WebHandler Language= "C#" Class= "UploadHandler" %>
using System;
using System.IO;
using System.Net;
using System.Web;
public class UploadHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain" ;
context.Response.Charset = "utf-8" ;
HttpPostedFile oFile = context.Request.Files[ "Filedata" ];
string strUploadPath = HttpContext.Current.Server.MapPath(@context.Request[ "folder" ])+ "\\" ;
if (oFile != null )
{
if (!Directory.Exists(strUploadPath))
{
Directory.CreateDirectory(strUploadPath);
}
oFile.SaveAs(strUploadPath + oFile.FileName);
context.Response.Write( "1" );
}
else
{
context.Response.Write( "0" );
}
}
public bool IsReusable
{
get { return false ; }
}
}
|
2011-3-18
其他版本:blueimp-jQuery-File-Upload c# 在54楼 下载 不同上面那个!!
点击Flash按钮无法打开链接的解决方案:
http://www.cnblogs.com/zengxiangzhan/archive/2009/09/12/1565349.html
本文转自曾祥展博客园博客,原文链接:http://www.cnblogs.com/zengxiangzhan/archive/2009/12/14/1623221.html,如需转载请自行联系原作者
Uploadify jquery+falsh+UploadHandler.ashx相关推荐
- Uploadify jquery+flash+UploadHandler.ashx .(用)
官方网:http://www.uploadify.com/ 只有PHP版本 对于我们.net的来说是一个遗憾!现在奉献一个c#版本,希望对大家有用. 看代码其实很简单,在做这个之前遇到许多问题,特别是 ...
- ashx 获取上传的文件_使用jQuery Post从.ashx获取文件
这个问题来自我提出的另一个问题 - Passing client data to server to create Excel or CSV File. 我有一个客户端页面,它建立一个JSON对象发送 ...
- 利用jquery getJSON 调用ashx实现ajax调用
一个页面中放入不同业务逻辑的div,利用ajax调用.net ashx页面根据不同的返回值显示,隐藏不同的div. 1.ashx返回JSON格式的内容,注意context.Response.Conte ...
- PHP Uploadify+jQuery.imgAreaSelect插件+AJAX 实现图片上传裁剪 仿微博头像上传功能
http://blog.csdn.net/as66t/article/details/11688217 http://blog.mc-zone.me/article/226#comment-2991 ...
- jquery文件上传插件 uploadify java_jQuery文件上传插件Uploadify使用指南
对于HTML5版本会比较好的支持手机浏览器,避免苹果手机Safari浏览器不支持 Flash,主要特性:支持多文件上传.HTML5版本可拖拽上传.实时上传进度条显示.强大的参数 定制功能,如文件大小. ...
- JQuery上传插件Uploadify使用详解
Uploadify是JQuery的一个上传插件,实现的效果非常不错,带进度显示.不过官方提供的实例时php版本的,本文将详细介绍Uploadify在Aspnet中的使用,您也可以点击下面的链接进行演示 ...
- jquery.uploadify参数
uploadify函数的参数为json格式,可以对json对象的key值的修改来进行自定义的设置,如multi设置为true或false来控制是否可以进行多文件上传,下面就来介绍下这些key值的意思: ...
- JQuery上传插件Uploadify使用详解 http://www.cnblogs.com/oec2003/archive/2010/01/06/1640027.html
Uploadify是JQuery的一个上传插件,实现的效果非常不错,带进度显示.不过官方提供的实例时php版本的,本文将详细介绍Uploadify在Aspnet中的使用,您也可以点击下面的链接进行演示 ...
- C# 一般处理程序+jquery.uploadify.js 多文件上传图片/文件
效果图: 首先引入: <script src="assets/js/jquery-1.8.2.min.js"></script> & ...
最新文章
- 和12岁小同志搞创客开发:如何驱动LCD1602液晶显示屏?
- MySQL学习----各种字符的长度总结
- 基于深度学习的文本数据特征提取方法之Glove和FastText
- Gartner:中国CIO们正将IT预算投向数字化
- 【暴力】UVALive - 4882 - Parenthesis
- centos7安装3.6版本zookeeper和jdk8
- Intel Sandy Bridge/Ivy Bridge架构/微架构/流水线 (7) - 流水线前端/译码后指令缓存
- TimesTen更改CacheGroup管理用户ORACLE结束和TT结束password【TimesTen操作和维修基地】...
- 祝威廉 :Rust FFI 实践
- Kotlin的中文文档
- 宋红康Java基础笔记
- 局域网计算机维护工具,局域网共享工具,教您局域网共享工具
- 在线支付功能的设计及其实现
- three.js尝试(一)模拟演唱会效果
- 前端部署的灵魂拷问,你能回答出几个?【部署必看篇】
- 迭代、原型、螺旋、敏捷模型之间的区别
- pg中多值列_PostgreSQL中列的statistics属性
- java 向下转型有什么用_java向下转型,有啥作用。求解
- Linux服务器集群部署
- qt-embedd-linux4.8.2编译配置选项说明
热门文章
- 牛逼,国产开源的远程桌面火了,只有9MB,支持自建中继器!
- 蚂蚁金服开源增强版Spring Boot 的研发框架!
- 自己动手在 Linux 系统实现一个 everything 程序
- 你还在使用 try-catch-finally 关闭资源?
- 问一下,线程池里面到底该设置多少个线程?
- 9个让PyTorch模型训练提速的技巧!
- one-hot encoding不是万能的,这些分类变量编码方法你值得拥有
- 【pandas学习笔记】综合整理
- 算法炒房三月亏20多亿!房地产巨头大翻车:房价水太深,AI根本把握不住
- PyTorch 版 EfficientDet 比官方 TF 实现快 25 倍?这个 GitHub 项目数天狂揽千星