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;

public partial class upload : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    public string FileName
    {
        get
        {
            if (Session["filename"] != null)
                return Session["filename"].ToString();
            else
                return "";
        }


    }


    protected void btnUpload_Click(object sender, EventArgs e)
    {
        string strAppPath;
    string path = HttpContext.Current.Server.MapPath(@"~\UpLoadFile\");
    if (!Directory.Exists(path)) 
    {
     Directory.CreateDirectory(path);
    }

    if (this.File1.PostedFile.FileName != "")
    {
     string[] filetype = new string[]{"jpg","gif","png","JPG","GIF","PNG"};
     strAppPath = path+UploadFile(path, 204800, filetype, File1);
   strAppPath= strAppPath.Replace("/", @"\").Replace(@"\", @"\\");
     Session["filename"] = strAppPath;
    }

    ClientScript.RegisterStartupScript(this.GetType(), "clear", "<script>closewin()</script>");

    }
}
