文件上传利器SWFUpload使用指南
这里就不再介绍什么是SWFUpload啦,简单为大家写一个简单关于SWFUpload的Demo。
1.把SWFUpload 相关的文件引用进来

2.创建upload.aspx页面(页面名称可自定义),
-前台页面代码如下:
<!DOCTYPE html> <html>
<head id="Head1" runat="server">
<title>SWFUpload Application Demo (ASP.Net 2.0)</title>
<link href="../assets/lib/ckeditor/plugins/codesnippet/lib/highlight/styles/default.css" rel="stylesheet" />
<script src="../assets/lib/swfupload/swfupload.js"></script>
<script src="../assets/lib/swfupload/handlers.js"></script>
<script type="text/javascript">
var swfu;
window.onload = function () {
swfu = new SWFUpload({
// Backend Settings
//上传请求处理地址
upload_url: "upload.aspx",
//POST提交同时伴随上传的键值对
post_params: {
<%--"ASPSESSID": "<%=Session.SessionID %>"--%>
}, // File Upload Settings
//最大文件限制
file_size_limit: "2 MB",
//上传的文件类型
file_types: "*.jpg",
//点击弹出浏览窗口的文件默认类型
file_types_description: "JPG Images",
file_upload_limit: , // Zero means unlimited // Event Handler Settings - these functions as defined in Handlers.js
// The handlers are not part of SWFUpload but are part of my website and control how
// my website reacts to the SWFUpload events.
swfupload_preload_handler: preLoad,
swfupload_load_failed_handler: loadFailed,
file_queue_error_handler: fileQueueError,
file_dialog_complete_handler: fileDialogComplete,
upload_progress_handler: uploadProgress,
upload_error_handler: uploadError,
upload_success_handler: function (file, serverData) {document.getElementById("img").src=serverData},
upload_complete_handler: uploadComplete, // Button settings
button_image_url: "../assets/lib/swfupload/images/XPButtonNoText_160x22.png",
button_placeholder_id: "spanButtonPlaceholder",
button_width: ,
button_height: ,
button_text: '<span class="button">选择图片 <span class="buttonSmall">(2 MB Max)</span></span>',
button_text_style: '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }',
button_text_top_padding: ,
button_text_left_padding: , // Flash Settings
flash_url: "../assets/lib/swfupload/swfupload.swf", // Relative to this file
flash9_url: "../assets/lib/swfupload/swfupload_FP9.swf", // Relative to this file custom_settings: {
upload_target: "divFileProgressContainer"
}, // Debug Settings
debug: false
});
}
</script>
</head>
<body>
<form id="form1" runat="server"> <div id="content"> <div id="swfu_container" style="margin: 0px 10px;">
<div>
<span id="spanButtonPlaceholder"></span>
</div>
<div id="divFileProgressContainer" style="height: 75px;"></div>
<div id="thumbnails">
<img id="img" src="#" alt="" />
</div>
</div>
</div>
</form>
</body>
</html>
-后台页面代码如下:
public partial class upload : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.IsPostBack())
{
//
foreach (string key in Request.Files)
{
Request.Files[key].SaveAs(Server.MapPath("~/uploads/" + Request.Files[key].FileName));
Response.Write("/uploads/" + Request.Files[key].FileName);
} Response.End();
}
}
}
注:里面的一些使用方式已经为大家附上注释,自己可以简单看下。
文件上传利器SWFUpload使用指南的更多相关文章
- 文件上传利器SWFUpload使用指南(转)
http://www.cnblogs.com/2050/archive/2012/08/29/2662932.html 文件上传利器SWFUpload使用指南 SWFUpload是一个flash和js ...
- [Plugin] 文件上传利器SWFUpload使用指南
SWFUpload是 一个flash和js相结合而成的文件上传插件,其功能非常强大.以前在项目中用过几次,但它的配置参数太多了,用过后就忘记怎么用了,到以后要用时又得 到官网上看它的文档,真是太烦了. ...
- 文件上传利器SWFUpload入门简易教程
凡做过网站开发的都应该知道表单file的确鸡肋. Ajax解决了不刷新页面提交表单,但是却没有解决文件上传不刷新页面,当然也有其它技术让不刷新页面而提交文件,该技术主要是利用隐藏的iFrame, 较A ...
- 文件上传工具swfupload[转]
转至:http://zhangqgc.iteye.com/blog/906419 文件上传工具swfupload 示例: 1.JavaScript设置SWFUpload部分(与官方例子类似): var ...
- 文件上传:swfupload.js、blueimp-file-upload
一.swfupload 1.下载swfupload http://code.google.com/p/swfupload/ 2. 3.API http://www.cnblogs.com/henw/ ...
- 文件上传利器JQuery上传插件Uploadify
在做日常项目中,经常在后台需要上传图片等资源文件,之前使用过几次这个组件,感觉非常好用 ,但是每次使用的时候都是需要经过一番查阅,所以还不如记住在这里,以后使用的时候就翻翻. 他的官方网站如下:htt ...
- [转]腾讯云Linux云服务器文件上传利器——WinSCP
本文转自:http://bbs.qcloud.com/thread-4379-1-1.html WinSCP简介 WinSCP是一个Windows环境下使用SSH的开源图形化SFTP客户端.同时支持S ...
- 多图片/文件上传 - SwfUpload/PlUpload
<文件上传利器SWFUpload使用指南> <前端上传组件Plupload使用指南>
- 前端上传组件Plupload使用指南
我之前写过一篇文章<文件上传利器SWFUpload使用指南>,里面介绍了上传组件SWFUpload的使用方法,但现在随着html5技术的逐渐推广和普及,再去使用以flash为上传手段的SW ...
随机推荐
- GCC参数详解
GCC参数详解 [介绍] gcc and g++分别是gnu的c & c++编译器 gcc/g++在执行编译工作的时候,总共需要4步 1.预处理,生成.i的文件 2.将预处理后的文件不转换成汇 ...
- __str__
__str__是被print函数调用的,一般都是return一个什么东西.这个东西应该是以字符串的形式表现的.如果不是要用str()函数转换.当你打印一个类的时候,那么print首先调用的就是类里面的 ...
- 玩玩hibernate
这几天师兄,让我玩玩hibernate,然后通过这个玩意写爬虫(spider).这一说不打紧,嗯,一个星期没有了,全都是由于配置环境,心很塞,整个星期的空闲时间都用来做重复的工作.在学习之前,我先查找 ...
- openstack 集成显卡 对windroye 支持
- [学习笔记]设计模式之Singleton
写在前面 为方便读者,本文已添加至索引: 设计模式 魔法手札索引 在前几篇笔记中,我们有了解了部分对象创建型模式,包括Builder(建造者).Abstract Factory(抽象工厂)和Facto ...
- Code Forces 711C Coloring Trees
C. Coloring Trees time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- svn 被锁定
遇到svn被锁定,clearup 不管用一直报错 用命令行解决了 问题 : command line -> cmd>svn help>svn cleanup>exit
- git与svn的区别-小结一下
1)Git是分布式的,SVN不是: 这 是GIT和其它非分布式的版本控制系 统,例如SVN,CVS等,最核心的区别.好处是跟其他同事不会有太多的冲突,自己写的代码放在自己电脑上,一段时间后再提交.合并 ...
- cas改造随笔
原http://www.cnblogs.com/hellowood/archive/2010/08/05/1793364.html 键字: sso域名:cas.server.com 登陆地址(spri ...
- LabSharp莱博夏普简介
莱博夏普提供实验室信息化解决方案,为实验室提供LIMS系统建设方案咨询,并为中小型LIMS系统供应商提供系统解决方案咨询.