Home  >  Article  >  Web Front-end  >  Detailed explanation of the use of JQuery.uploadify upload file plug-in for ASP.NET_jquery

Detailed explanation of the use of JQuery.uploadify upload file plug-in for ASP.NET_jquery

WBOY
WBOYOriginal
2016-05-16 18:36:041189browse

Later, a friend recommended an upload plug-in called uploadify. It seemed to be very good, so I downloaded a sample from the official website and ran it. It felt very good. I just beautified it a little and it was OK...!

Let’s talk about the usage process:

1. Download

Official website: http://www.uploadify.com/

Direct download: jquery.uploadify-v2.1.0.rar

My Demo: MyUpload.rar The official website also has a demo

After downloading and unzipping:

 

Note: It contains demo but it is for PHP, and there is also a help document: uploadify v2.1.0 Manual.pdf.

2. Create project:

The structure is as shown in the figure>>

File description:

All files in the A.js folder: required, unzip and copy them from the downloaded package, you can change the name yourself

B.Default.aspx: Test page, no code in the background

Copy code The code is as follows:

<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>



Usage of jquery.uploadify upload plug-in









Upload| Cancel upload





C.Upload.aspx: Process uploaded files
Copy code The code is as follows:

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

Code
Copy code The code is as follows:

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.最后说说:这个只是一个简单的入门例子,至于界面可以根据自己的需要去改

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn