| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 686 人关注过本帖
标题:上傳的怪問題
只看楼主 加入收藏
david0620
Rank: 1
等 级:新手上路
帖 子:97
专家分:0
注 册:2007-3-13
收藏
 问题点数:0 回复次数:7 
上傳的怪問題

我的上傳代碼 :
<%@ Language=vbscript %>
<html><head><title>FileList</title>
<!--#include file="errorclass.asp"-->
<!--#include file="class.asp"-->
<%
Dim fc_Class,ec_Class,objStream
Dim UpUser,JzName,CsName,Path,Remark
Set fc_Class = New MBClass
Set ec_Class = New ErrorClass
If Request.QueryString("action") = 1 Then
If getForm = 1 Then
If upFile(path) = 1 Then
Path = GetFileName(Path)
Call fc_Class.addmb(UpUser,JzName,CsName,Path,Remark)
If ERR.number <> 0 Then
ec_Class.Founderr = True
ec_Class.Message = ec_Class.Message&"向数据库添加记录失败<br>"
Call ec_Class.showMessage("add.asp","失败")
Else
ec_Class.Message = ec_Class.Message&"添加记录成功<br>"
Call ec_Class.showMessage("add.asp","成功")
End If
Else
Call ec_Class.showMessage("add.asp","失败")
End If
ElseIf ec_Class.Founderr = true Then
Call ec_Class.showMessage("add.asp","失败")
End If
End If
Function upFile(filepath)
if request.form("path")<>"" then
filepath = Request.Form("path")
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1 ' adTypeBinary
objStream.Open
objStream.LoadFromFile filepath
objStream.SaveToFile "d:\file\MB\"&GetFileName(filepath),2
objStream.Close
If Err.number <> 0 Then
ec_Class.Founderr = True
ec_Class.Message = ec_Class.Message&"文件上传失败<br>"
upFile = 0
Else
ec_Class.Message = ec_Class.Message&"文件上传成功<br>"
upFile = 1
End If
End If
End Function
Function GetFileName(filepath)
If filepath <> "" Then
GetFileName = mid(filepath,InStrRev(filepath, "\")+1)
Else
GetFileName = ""
End If
End function
Function getForm()
UpUser = trim(Request.Form("upuser"))
JzName = trim(Request.Form("jzname"))
CsName = trim(Request.Form("csname"))
Path = trim(Request.Form("path"))
Remark = trim(Request.Form("remark"))
If UpUser = "" Then
ec_Class.Founderr = True
ec_Class.Message = ec_Class.Message&"工程师名不能为空<br>"
End If
If JzName = "" Then
ec_Class.Founderr = True
ec_Class.Message = ec_Class.Message&"机种名不能为空<br>"
End If
If CsName = "" Then
ec_Class.Founderr = True
ec_Class.Message = ec_Class.Message&"修改程序名不能为空<br>"
End If
If Path = "" Then
ec_Class.Founderr = True
ec_Class.Message = ec_Class.Message&"上传路径不能为空<br>"
End If
If Remark = "" Then
ec_Class.Founderr = True
ec_Class.Message = ec_Class.Message&"修改原因不能为空<br>"
End If
If ec_Class.Founderr = True Then
getForm = 0
Else
getForm = 1
End If
End Function
%>
<body>
<table id="table1" width="80%" align="center">
<tr><td valign="top" height="38">
<table class="style8" id="table2" width="100%" border="0">
<tr>
<td width="70">文件上传</td>
<td align="right"></td></tr>
</table></td></tr>
<tr><td>
<hr color="#666666" size="1">
<form action="add.asp?action=1 "id="form1" name="form1" method="post">
<table width="500" border="1" align="center" bgcolor="#cccc99">
<tr><td width="250">
<font face="新细明体">工程师:</font></td>
<td><input id="text1" type="text" name="upuser"></td></tr>
<tr><td>
<font face="新细明体">机种名:</font></td>
<td><input id="text2" type="text" name="jzname"></td></tr>
<tr><td>
<font face="新细明体">修改程序名:</font></td>
<td><input id="text3" type="text" name="csname"></td></tr>
<tr><td>
<font face="新细明体">文件路径:</font></td>
<td><input id="text4" type="file" name="path"></font></td></tr>
<tr><td>
<font face="新细明体">修改原因:</font></td>
<td><font face="新细明体">
<textarea id="textarea1" name="remark" rows="7" cols="23">
</textarea></font></td></tr>
<tr><td colspan="2" align="center">
<input id="submit1" type="submit" value="提交" class="style1">
<input id="reset1" type="reset" value="重填" class="style1">
</td></tr>
</table></form></td></tr></table>
<hr width="80%" color="#666666" size="1">
</body>
</html>


我可以在服務器的IE上進行使用,但是在別的電腦上進行調用時卻報以下的錯誤:
這是什麼原因,高手們幫幫忙啊...........

技术信息 (供技术支援人员使用)

错误类型:
ADODB.Stream (0x800A0BBA)
无法开启档案。
/add.asp, line 36


浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

页数:
POST 62 bytes to /add.asp

POST Data:
upuser=d&jzname=d&csname=d&path=C%3A%5Cconcole1df.exe&remark=d

时间:
2007年7月25日, 下午 03:33:56


其他信息:
Microsoft Support

搜索更多相关主题的帖子: html include action title file 
2007-07-25 15:39
david0620
Rank: 1
等 级:新手上路
帖 子:97
专家分:0
注 册:2007-3-13
收藏
得分:0 
who can help me?
2007-07-26 07:42
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
"d:\file\MB\"&GetFileName(filepath),2

你确定年使用的机器上有这目录吗

专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-07-26 08:21
david0620
Rank: 1
等 级:新手上路
帖 子:97
专家分:0
注 册:2007-3-13
收藏
得分:0 
以下是引用阳光白雪在2007-7-26 8:21:56的发言:
"d:\file\MB\"&GetFileName(filepath),2

你确定年使用的机器上有这目录吗

是啊,我的服務器的存儲路徑是d:\file\mb這個目錄。。

2007-07-26 09:24
david0620
Rank: 1
等 级:新手上路
帖 子:97
专家分:0
注 册:2007-3-13
收藏
得分:0 

upload.asp文件
<%
Function GetFileName(ByVal strFile)
If strFile <> "" Then
GetFileName = mid(strFile,InStrRev(strFile, "\")+1)
Else
GetFileName = ""
End If
End function

strFileName = Request.Form("file1")
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1 ' adTypeBinary
objStream.Open
objStream.LoadFromFile strFileName
objStream.SaveToFile Server.MapPath(GetFileName(strFileName)),2
objStream.Close
%>

upload.htm文件
<form name="FORM" action="upload.asp" method="post">
  <input type="submit" name="submit" value="OK">
<input type="file" name="file1" style="width:400" value="">
</form>

版主,其实我用的就是这两个文件的扩展,但是这两个文件在服务器的IE上运行是没有问题的,不过在别的电脑上运行就提示说
錯誤類型:
ADODB.Stream (0x800A0BBA)
無法開啟此檔案。
/upload.asp, line14
我想应该是没有办法取得客户的文件路径所至

2007-07-26 09:29
david0620
Rank: 1
等 级:新手上路
帖 子:97
专家分:0
注 册:2007-3-13
收藏
得分:0 
救命啊...........
2007-07-26 09:46
david0620
Rank: 1
等 级:新手上路
帖 子:97
专家分:0
注 册:2007-3-13
收藏
得分:0 
版主們,幫幫忙啊
2007-07-26 10:13
david0620
Rank: 1
等 级:新手上路
帖 子:97
专家分:0
注 册:2007-3-13
收藏
得分:0 
如果我將objStream.LoadFromFile strFileName取消的話,客戶機就可以上傳文件了,不過上傳到服務器的文件都是空的,沒有內容
2007-07-26 10:47
快速回复:上傳的怪問題
数据加载中...
 
   



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

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