| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 595 人关注过本帖
标题:[求助]上传文件错误!!??
只看楼主 加入收藏
35maoe
Rank: 1
等 级:新手上路
帖 子:341
专家分:0
注 册:2006-8-28
结帖率:100%
收藏
 问题点数:0 回复次数:3 
[求助]上传文件错误!!??

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: CS0246: The type or namespace name 'UploadFile' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 21: {
Line 22: //设置htmlinputfile控件的属性
Line 23: UploadFile.Maxlength = 30;
Line 24: UploadFile.size =20;
Line 25: }

Source File: F:\123456\uploadsinglefile.aspx Line: 23

Show Detailed Compiler Output:
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

搜索更多相关主题的帖子: 文件 The name 
2006-09-05 16:30
srufeng
Rank: 1
等 级:新手上路
威 望:2
帖 子:152
专家分:0
注 册:2006-6-5
收藏
得分:0 
这个值是只读的

2006-09-05 17:41
35maoe
Rank: 1
等 级:新手上路
帖 子:341
专家分:0
注 册:2006-8-28
收藏
得分:0 

如何修改,这些都照实例写的,还错误,还有一个多文件上传也错误,都是按照实例写的呀


2006-09-06 08:05
35maoe
Rank: 1
等 级:新手上路
帖 子:341
专家分:0
注 册:2006-8-28
收藏
得分:0 

这是原代码,照教程写的,但运行错误呀??!!!

<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


2006-09-06 09:28
快速回复:[求助]上传文件错误!!??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027490 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved