急!无组件上传,本地正确,为什么放到服务器上去后就有错。
上传文件到指定目录下,然后把文件名存储到数据库。
源程序如下:
<%
'------------------------------------------------------------------
.....省略dim
btn=request("btn")
if btn="1" then
image=request("image")
imagename=GetFileName(image)
if imagename<>"no" then
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.mode=3
objStream.Type = 1 ' adTypeBinary
objStream.Open
objStream.LoadFromFile image
filepath=server.MapPath("files")
filepath=filepath&"\"&imagename
objStream.SaveToFile filepath,2
objStream.Close
end if
Set conn=Server.CreateObject("ADODB.Connection")
dbpath=Server.MapPath("db/db.mdb")
conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ="&dbpath
strsql="insert into ....(省略)"
set rs=conn.execute(strsql)
......
end if
‘-----------------------------------------------------------------------
Function GetFileName(ByVal strFile)
If strFile <>"" Then
GetFileName = mid(strFile,InStrRev(strFile,"\")+1)
Else
GetFileName = "no"
End If
End function
%>
<html>
<body>
<form method="post" action="regist.asp" class="b" name="reg" >
<div align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="136"> Property Name: </td>
<td width="166">
<input name="loupanname" size="30" maxlength="100" >
</td>
</tr>
<tr>
<td width="136"> About Image: </td>
<td width="166">
<input type="file" name="image">
</td>
</tr>
<tr align="middle">
<td colspan =2>
<input type="submit" value="regist" name="regist" size="18" "javascript:reg.btn.value=1;">
<input type="reset" value="reset" name="B2" size="18">
</td>
</tr>
<input type="hidden" name="btn" value=""></form>
</table>
</body>
</html>
然后,我在本地运行都是好的,但是放到服务器上后,一旦有图片上传,就发生错误,页面上显示的是http 500 内部服务器错误。
不清楚是什么原因。
难道是服务器的环境没有iis4.0,ado2.5以上吗?
如果是服务器环境的原因,那我还有其他的解决方案吗?
请指教,急,谢谢