ҪҪĿ¼½Ŀ¼:upfileupimg
һFileUploadؼ.һButton.һImage.һLabel


ؼ:
string name = FileUpload1.FileName;//ϴļ.
        string size = FileUpload1.PostedFile.ContentLength.ToString();//ļС.
        string type = FileUpload1.PostedFile.ContentType;//ļ.
        string type2 = name.Substring(name.LastIndexOf(".") + 1);//LastIndexOf()һλƥ.Substring()+1.
        string ipath = Server.MapPath("upimg") + "\\" + name;//ȡøĿ¼upimgĿ¼·.
        string fpath = Server.MapPath("upfile") + "\\" + name;
        string wpath = "upimg\\" + name;//·.
        if (type2 == "jpg" || type2 == "gif" || type2 == "bmp" || type2 == "png")
        {
            FileUpload1.SaveAs(ipath);//淽,һַַ.
            Image1.ImageUrl = wpath;
            Label1.Text = "㴫ļ:" + name + "<br>ļСΪ:" + size + "ֽ<br>ļ:" + type +
                "<br>׺:" + type2 + "<br>ʵ·:" + ipath + "<br>·:" + fpath;
            Image1.Visible = true;
        }
        else
        {
            Image1.Visible = false;
            FileUpload1.SaveAs(fpath);
            Label1.Text = "㴫ļ:" + name + "<br>ļСΪ:" + size + "ֽ<br>ļ:" + type +
                "<br>׺:" + type2 + "<br>ʵ·:" + ipath + "<br>·:" + fpath;
        }