这是原代码,照教程写的,但运行错误呀??!!!
<script language="c#" runat="server">
public void DoUpload(Object src,EventArgs e)
{
//取得上传文件的个数
int FileCount=Request.Files.Count;
String uploadfilename;
String[] afilename;
char[] de ={'\\'};
for (int i=0; i<FileCount;i++)
{
HttpPostedFile hpf = Request.Files[i];
AFilename = hpf.FileName.Split{de};
Uploadfilename=AFilename[AFilename.Length-1];
hpf.saveas(server.mappath(".")+"\\"+Uploadfilename);
//在panel控件中显示上传过程
addpanelcontrols(Uploadfilename);
}
}
public void addpanelcontrols(String filename)
{
label lblshow=New label();
lblshow.text=filename+"已经上传<br>";
panell.controls.add(lblshow);
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>上传多个文件</title>
</head>
<body>
<form enctype="multipart/form-data" runat="server">
<b>上传单个文件</b>
请选择文件上传1:<input type="file" id="uploadfile1" runat="server"><br>
请选择文件上传2:<input type="file" id="uploadfile2" runat="server"><br>
请选择文件上传3:<input type="file" id="uploadfile3" runat="server"><br>
请选择文件上传4:<input type="file" id="uploadfile4" runat="server"><br>
请选择文件上传5:<input type="file" id="uploadfile5" runat="server"><br>
请选择文件上传6:<input type="file" id="uploadfile6" runat="server"><br>
<input types="submit" value="上传" onserverclick="doupload" runat="server">
<br>
</form>
<hr>
<asp:panel id="panell" runat="server" />
</body>
</html>
############################################################################################
这是错误页面内容,请帮我看看什么原因,谢谢!!
Server Error in '/123456' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1002: ; expected
Source Error:
Line 12: HttpPostedFile hpf = Request.Files[i];
Line 13:
Line 14: AFilename = hpf.FileName.Split{de};
Line 15: Uploadfilename=AFilename[AFilename.Length-1];
Line 16: hpf.saveas(server.mappath(".")+"\\"+Uploadfilename);
Source File: F:\123456\uploadfile.aspx Line: 14