各位大哥,大姐们,小弟我做了个网站,就是图片不能上传,在本地测试成功,但是上传到远端就无法实现了,我知道可能是服务器环境改变了,但是不知道如何修改,求大哥,大姐们指点指点!!
提示错误:
Server.MapPath() error 'ASP 0171 : 80004005'
Missing Path
/dianzishangwu/xrclass23/upload.asp, line 26
The Path parameter must be specified for the MapPath method.
以下是代码:
<%Server.ScriptTimeout=180%>
<!--#include FILE="upinc.inc"-->
<html>
<head>
<title>文件上传</title>
<style type="text/css">
.p9{ font-size: 9pt; font-family: 宋体 }
.tx1 { width: 400 ;height: 20px; font-size: 9pt; border: 0px solid; border-color: black #000000; color: #0000FF}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body leftmargin="20" topmargin="20" class="p9">
<table align="center" border="1" cellpadding="6" cellspacing="0" bordercolor="#000000" class="p9" style="border-collapse: collapse">
<tr bgcolor="#CCCCCC">
<td align="center" height="25" valign='middle'>本地文件</td>
<td align="center" valign='middle'>大小(字节)</td>
<td align="center" valign='middle'>上传文件名</td>
<td align="center" valign='middle'>状态</td>
</tr>
<%
dim upfile,formPath,ServerPath,FSPath,filePath,formName,FileName,oFile,upfilecount
upfilecount=0
set upfile=new clsUp ''建立上传对象
upfile.NoAllowExt="asp;exe;htm;html;aspx;cs;vb;js;" '设置上传类型的黑名单
upfile.GetData (10240000) '取得上传数据,限制最大上传10M
filePath=Server.mappath(upfile.form("filePath"))&"\" 就是这行出错!!
ServerPath=GetFilePath(Request.ServerVariables("HTTP_REFERER"),"/")'取得在网站上的位置
for each formName in upfile.file '列出所有上传了的文件
set oFile=upfile.file(formname)
if oFile.FileSize=0 then
response.write"<SCRIPT language=JavaScript>alert('您没有上传文件呀!!!!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
if oFile.FileSize>0 then
if oFile.FileSize>5240000 then '限制最大上传5M
response.write"<SCRIPT language=JavaScript>alert('您上传的文件大于规定大小(5M),请改变文件大小后再进行上传。');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
end if
FileName=upfile.form(formName)'取得文本域的值
if not FileName>"" then FileName=oFile.filename else FileName=FileName&"."&oFile.FileExt
if upfile.form("fjr")=1 then
imgs=upfile.AutoSave (formname,filePath&FileName)
else
imgs=upfile.SaveToFile (formname,filePath&FileName)
end if
if upfile.iserr then
response.write"<SCRIPT language=JavaScript>alert('"&upfile.errmessage&"');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
%>
<tr>
<td align="center" height="20"><%=oFile.FilePath&oFile.FileName%></td>
<td align="center"><%=oFile.filesize%></td>
<td align="center"><input type=text size=40 name=upfile1 value=<%=upfile.form("filePath")&"/"&imgs%>></td>
<td align="center">
<%
if upfile.iserr then
Response.Write upfile.errmessage
else
upfilecount=upfilecount+1
Response.Write "上传成功"
end if
%></td>
</tr>
<%
set oFile=nothing
next
%>
<tr>
<td align="center" colspan="4" height="25" valign='middle'>一共上传了<%=upfileCount%>个文件,请复制上面的文件名和路径到相应的输入框,谢谢合作!! [<a href="upfile.asp">返回</a>]</td>
</tr>
<%
set upfile=nothing '删除此对象
%>
</table>
</body>
</html>
<%
function GetFilePath(FullPath,str)
If FullPath <> "" Then
GetFilePath = left(FullPath,InStrRev(FullPath, str))
Else
GetFilePath = ""
End If
End function
%>
请各位大虾指点一下!!