Jquery.uploadify Upload File plugin use detailed for asp.net_jquery

Source: Internet
Author: User

Later friend recommended a This is called uploadify upload plug-ins, it seems very good, to the official under a sample run, feeling very good, and then a little landscaping on the OK ...!

Now let's talk about using the process:

1. Download

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

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

My demo: Myupload.rar official website also has demo

Download after decompression:

Description: It has a demo inside but PHP, there is also a Help document: Uploadify v2.1.0 manual.pdf.

2. Create the project:

Structure as pictured >>

File Description:

All files under the A.js folder: required, extracted from the downloaded package to copy over, the name can be changed

B.default.aspx: Test page, background no code

Copy Code code as follows:

<%@ Page language= "C #" autoeventwireup= "true" codebehind= "Default.aspx.cs" inherits= "Webapplication2._default"% >
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
Use of <title>jquery.uploadify upload plugin </title>
<link rel= "Stylesheet" href= "Js/uploadify.css"/>
<script type= "Text/javascript" src= "Js/jquery.min.js" ></script>
<script type= "Text/javascript" src= "Js/swfobject.js" ></script>
<script type= "Text/javascript" src= "Js/jquery.uploadify.min.js" ></script>
<script type= "Text/javascript" >
$ (document). Ready (function () {
$ ("#uploadify"). Uploadify ({
' Uploader ': ' js/uploadify.swf ',
' Script ': ' upload.aspx ',
' cancelimg ': ' Js/cancel.png ',
' Folder ': ' Upload ',
' Queueid ': ' Filequeue ',
' Auto ': false,
' Multi ': true,
});
});
</script>
<body>
<form id= "Form1" runat= "Server" >
<input type= "File" Name= "uploadify" id= "Uploadify"/>
<a href= "javascript:$ (' #uploadify '). Uploadifyupload ()" > Upload </a>| <a href= "javascript:$ (' #uploadify '). Uploadifyclearqueue ()" > Cancel upload </a>
<div id= "Filequeue" ></div>
</form>
</body>

C.upload.aspx: Handling uploaded files
Copy Code code as follows:

<%@ Page language= "C #" autoeventwireup= "true" codebehind= "Upload.aspx.cs" inherits= "Webapplication2.upload"%>

Code
Copy Code code 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 This file Plus is also necessary
3. Operation Result:

4. Finally say: This is just a simple example of getting started, as the interface can be changed according to their own needs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.