Heim  >  Artikel  >  Web-Frontend  >  Jquery Uploadify上传带进度条的简单实例_jquery

Jquery Uploadify上传带进度条的简单实例_jquery

WBOY
WBOYOriginal
2016-05-16 17:00:281047Durchsuche

复制代码 代码如下:



    Jquery Uploadify上传带进度条
   
   
   
   
   


   

   


   

   


   


   
   


        上传|
        取消上传
   





复制代码 代码如下:

using System;
using System.Web;
using System.IO;

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 uploadPath = HttpContext.Current.Server.MapPath(@context.Request["folder"]);

        if (file != null)
        {
            if (!Directory.Exists(uploadPath))
            {
                Directory.CreateDirectory(uploadPath);
            }
            file.SaveAs(Path.Combine(uploadPath, file.FileName));
            context.Response.Write("1");
        }
        else
        {
            context.Response.Write("0");
        }
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }
}

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn