JQuery.uploadify 上传文件插件的使用详解 for ASP.NET

2020-05-22 16:20:01易采站长站整理

<div id=”fileQueue”></div>
</form>
</body>
</html>

C.Upload.aspx: 处理上传文件

<%@ Page Language=”C#” AutoEventWireup=”true” CodeBehind=”Upload.aspx.cs” Inherits=”WebApplication2.Upload” %>

代码

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
namespace WebApplication2
{
public partial class Upload : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HttpPostedFile file = Request.Files[“FileData”];
string uploadpath = Server.MapPath(Request[“folder”] + “”);
if (file != null)
{
if (!Directory.Exists(uploadpath))
{
Directory.CreateDirectory(uploadpath);
}
file.SaveAs(uploadpath + file.FileName);
Response.Write(“1”);
}
else
{
Response.Write(“0”);
}
}
}
}

D.upload这个文件加也是必需
3.运行结果:


  


4.最后说说:这个只是一个简单的入门例子,至于界面可以根据自己的需要去改