文件上传利器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 ...
随机推荐
- 最短路(数据处理):HDU 5817 Ice Walls
Have you ever played DOTA? If so, you may know the hero, Invoker. As one of the few intelligence car ...
- Ubuntu全新系统一些配置
0.安装JDK,http://www.oracle.com/technetwork/java/javase/downloads/index.html 1.安装Intellij IDEA,https:/ ...
- Java---replace与replaceAll的区别
乍一看,字面上理解好像replace只替换第一个出现的字符(受javascript的影响),replaceall替换所有的字符,其实大不然,只是替换的用途不一样. 这两者很容易搞混,在这里详细讲述下. ...
- JavaScript高级程序设计52.pdf
表单脚本 表单的基础知识 在HTML中,表单是由<form>元素表示的,在Javascript对应的是HTMLFormElement类型,它继承自HTMLElement,因此具有与其他HT ...
- HW4.13
public class Solution { public static void main(String[] args) { int n = 0; while(n * n * n < 120 ...
- 知道创宇爬虫题--代码持续更新中 - littlethunder的专栏 - 博客频道 - CSDN.NET
知道创宇爬虫题--代码持续更新中 - littlethunder的专栏 - 博客频道 - CSDN.NET undefined 公司介绍 - 数人科技 undefined
- mv、umask、chattr、lsattr命令
mv命令行,即move 将文件移动到目录下 对文件或目录重命名 umask chattr 设置文件或目录的隐藏属性 lsattr显示文件或目录的隐藏属性 ls mv 1.txt aa ls cd aa ...
- cocos 事件转发
CCDirector在函数setOpenGLView中设置pobOpenGLView,同时会掉用 m_pobOpenGLView->setTouchDelegate(m_pTouchDispat ...
- 使用CLRMD编写一个自己的C#调试器
博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:使用CLRMD编写一个自己的C#调试器.
- 应用程序无法正常启动0xc0150002 解决方式
我也遇到过此问题,解决的方法: 方案一: 在项目的"属性|配置属性|链接器|常规"中的"启用增量链接"选择"否".此方法阻断了问题产 ...