不包含定义

来源:互联网 发布:用友票据通软件 编辑:程序博客网 时间:2024/05/21 11:34

为什么编译的时候一直提示不包含File1的定义,可运行起来又很正常,编译老过不去,真郁闷。

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;

public partial class product_up_data : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //string path = Request.QueryString["tbxLogo"];

        //Response.Write("<script>window.alert('path:" + path + "');</script>");
    }

 }

 


    protected void Button2_Click1(object sender, EventArgs e)
    {
        if (this.File1.Value == "")
        {
            Response.Write("<script>window.alert('请选择图片文件!');</script>");
        }
        else
        {
            string path = Request.QueryString["tbxLogo"];
            string type = "shop";
            string nam = File1.PostedFile.FileName;
            int i = nam.LastIndexOf(".");
            string newext = nam.Substring(i);
            if (newext != ".jpg")
            {
                Response.Write("<script>window.alert('必须是后缀名为.jpg的文件!');</script>");

            }
            else
            {
                if (File1.PostedFile.ContentLength > 200000)
                {
                    // Response.Write("<script>window.alert('" + myFile.PostedFile.ContentLength.ToString() + "');</script>");
                    Response.Write("<script>window.alert('对不起,你上传的文件太大了!');</script>");
                }
                else
                {
                    File1.PostedFile.SaveAs(Server.MapPath("" + path + "" + Session["user_id"].ToString() + type + newext));


                    Response.Write("<script>");
                    Response.Write("alert('文件上传成功!');");
                    Response.Write("window.returnValue='" + Session["user_id"].ToString() + type + newext + "';");
                    //Response.Write("close();");
                    Response.Write("</script>");
                }
            }
        }
       
    }

原创粉丝点击