我这个有什么错?
private string GetFileNameAndPost(FileUpload fld,Label msg){
string fName = "";
if (fld.FileName.Trim() == "" || !(fld.FileName))
{
msg.Text = "未上传";
return "";
}
else
{
string fname = fld.PostedFile.FileName;
//if(fld.PostedFile.ContentType !=
if (fname.LastIndexOf("\\") > -1)
{
fname = fname.Substring(fname.LastIndexOf("\\") + 1);
fld.PostedFile.SaveAs(Server.MapPath("system\\cus_Picture\\" + fname));
fName = fname;
msg.Text = fName + "上传成功";
}
else
{
msg.Text = fname + "上传失败";
return "";
}
}
return fName;
}
protected void Button4_Click(object sender, EventArgs e)
{
GetFileNameAndPost(FileUpload1, Label1);
GetFileNameAndPost(FileUpload2, Label2);
GetFileNameAndPost(FileUpload3, Label3);
}