主题:ASP.NET文件上传控件FileUpload的一些属性,方法 寻求帮助?
if (FileUpload1.PostedFile != null)
{
FileUpload1.Visible = true;
string strDir = FileUpload1.PostedFile.FileName;
int myPos = strDir.LastIndexOf("\\");//???????
string strFileName = strDir.Substring(myPos);
string strPath = Server.MapPath("./load") + strFileName;
FileUpload1.PostedFile.SaveAs(strPath);
Label1.Visible = true;
this.Label2.Text = "文件名称:";
this.Label2.Text += FileUpload1.PostedFile.FileName;
this.Label3.Text = "保存路径:";
this.Label2.Text += strPath;
this.Label4.Text = "文件大小:";
this.Label4.Text += FileUpload1.PostedFile.ContentLength.ToString();
Label5.Text = "文件类型:";
Label5.Text += FileUpload1.PostedFile.ContentType;
}
请问int myPos = strDir.LastIndexOf("\\");//???????
string strFileName = strDir.Substring(myPos);
是什么意思??
还有就是 我上传大的文件就出错,请问默认上传多大的文件??
谢谢
{
FileUpload1.Visible = true;
string strDir = FileUpload1.PostedFile.FileName;
int myPos = strDir.LastIndexOf("\\");//???????
string strFileName = strDir.Substring(myPos);
string strPath = Server.MapPath("./load") + strFileName;
FileUpload1.PostedFile.SaveAs(strPath);
Label1.Visible = true;
this.Label2.Text = "文件名称:";
this.Label2.Text += FileUpload1.PostedFile.FileName;
this.Label3.Text = "保存路径:";
this.Label2.Text += strPath;
this.Label4.Text = "文件大小:";
this.Label4.Text += FileUpload1.PostedFile.ContentLength.ToString();
Label5.Text = "文件类型:";
Label5.Text += FileUpload1.PostedFile.ContentType;
}
请问int myPos = strDir.LastIndexOf("\\");//???????
string strFileName = strDir.Substring(myPos);
是什么意思??
还有就是 我上传大的文件就出错,请问默认上传多大的文件??
谢谢