<input id="file1" type="file" name="file1" style="width:397" value="" size="20"/>
————————————————————————————————————————————
private HttpPostedFile UploadFile
{
get
{
return this.Request.Files["file1"];
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (this.Request.Files["file1"] != null)
{
int startIndex = this.UploadFile.FileName.LastIndexOf(@"\") + 1;
string filename = this.UploadFile.FileName.Substring(startIndex);
string phyfilename = this.Server.MapPath(@"..\gxxz\uploadfiles\") + filename;
this.UploadFile.SaveAs(phyfilename);
Response.Write("<script>alert('上传成功!')</script>");
}
}
—————————————————————————————————————————————
页面上只有 <input id="Submit1" name="upSubmit" type="submit" value="上传" />这个
--------------------------------------------
if (this.Request.Files["file1"] != null) 我的这个怎么为空啊 ?????
别人也用的这个控件都能实现功能 ,我怎么用不得 ?缺少什么代码 ??