用.net改写的uploadify多文件上传控件
2014-05-20 09:05
232 查看
有图真相:
ASP.NET代码:
C#代码:
需要完整源码,请联系邮箱:wag.wag@163.com
ASP.NET代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UploadV2.aspx.cs" Inherits="TestUpload.UploadV2" %> <!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 runat="server"> <title></title> <link href="Scripts/uploadify-3.2.1/uploadify.css" rel="stylesheet" type="text/css" /> <script src="Scripts/jquery/jquery-1.8.1.min.js" type="text/javascript"></script> <script src="Scripts/uploadify-3.2.1/jquery.uploadify.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $('#file_upload').uploadify({ 'buttonText': '上传文件', 'width': 70, 'height': 20, 'swf': 'Scripts/uploadify-3.2.1/uploadify.swf', 'uploader': 'uploadhandler.ashx', 'onUploadSuccess' : function(file, data, response) { alert(data); }, 'onUploadComplete': function (file) { alert('The file ' + file.name + ' finished processing.'); } }); }); </script> </head> <body> <form id="form1" runat="server"> <div> <asp:FileUpload ID="file_upload" runat="server" /> </div> </form> </body> </html>
C#代码:
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace TestUpload { /// <summary> /// UploadHandler 的摘要说明 /// </summary> public class UploadHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Charset = "utf-8"; HttpPostedFile file = context.Request.Files["Filedata"]; string oldFileName = ""; string newFileName = ""; if (file != null) { oldFileName = file.FileName;//原文件名 newFileName = Guid.NewGuid().ToString(); int size = file.ContentLength;//附件大小 //context.Response.Write("{ Success = true, FileName = \"" + oldFileName + "\", SaveName = \"" + newFileName + "\" }"); } else { //context.Response.Write("{ Success = false, Message = \"请选择要上传的文件!\" }"); } context.Response.Write("上传的文件是:" + oldFileName); //return Json(new { Success = true, FileName = fileName, SaveName = saveName }); } public bool IsReusable { get { return false; } } } }
需要完整源码,请联系邮箱:wag.wag@163.com
相关文章推荐
- 【转载】文件上传控件uploadify
- 多文件上传控件uploadify介绍
- jquery文件上传控件 Uploadify
- ASP.NET文件上传控件Uploadify的使用方法
- 使用Uploadify(UploadiFive)多文件上传控件遇到的坑
- jquery文件上传控件 Uploadify
- jquery文件上传控件 Uploadify
- jquery文件上传控件 Uploadify 问题记录
- 关于uploadify的多文件上传控件
- ASP.NET文件上传控件Uploadify的使用方法
- uploadify 控件 在struts2中 上传大文件 提交报错 HTTP Error (404)
- jquery上传文件控件Uploadify
- jquery文件上传控件 Uploadify
- jquery文件批量上传控件Uploadify3.2(java springMVC)
- 基于jQuery的uploadify(flash上传文件)控件 的使用
- 多文件上传控件uploadify介绍
- jquery文件上传控件 Uploadify
- ASP.NET多文件上传控件Uploadify的使用方法
- jquery文件上传控件 Uploadify