我在上传文件时,对于压缩文件上传不上去,
是啥原因?
我的都可以啊
代码如下:
private void Submit1_ServerClick(object sender, System.EventArgs e)
{
int fileCount = Request.Files.Count;
string uploadFilename;
string fileName;
string [] aFilename;
char [] de = {'\\'};
for(int i =0 ;i < fileCount; i++)
{
HttpPostedFile hpf = Request.Files[i];
fileName = hpf.FileName;
if(fileName == "")
{
continue;
}
aFilename = hpf.FileName.Split(de);
uploadFilename = aFilename[aFilename.Length - 1];
hpf.SaveAs(Server.MapPath(".") + "\\temp\\" + uploadFilename);
//在panel控件中显示上传过程
AddPanelControls(uploadFilename);
}
}
public void AddPanelControls(string filename)
{
Label lblShow = new Label();
lblShow.Text = filename + "已经上传<br>";
Panel1.Controls.Add(lblShow);
}