asp上传功能,本地测试正确,远程找不到路径。
renze 2011-02-12 11:41:55 值:E:\pro\IDa.jpg值2:e:\www\web\User\PicIDCard\2010325112325.jpg
Microsoft VBScript 运行时错误 错误 '800a004c'
路径未找到
我已经将路径输出,路径是没有问题的。但不知道是什么原因,附源代码,功能是将本地文件覆盖远程的指定文件。
’------------------------------------------------------------------------------------------
<%
Dim Rs4,bigIDCard,smallIDCard
Set Rs4=server.createobject("adodb.recordset")
Rs4.open "select * from UserFile where dlID='"&UserName&"'",conn,1,3
if Not Rs4.eof then
bigIDCard=Rs4("PicIDCard")
smallIDCard=Rs4("PicIDCard2")
End if
'-------------------------------------------------------------------------
'#处理上传文件
if Request.QueryString("action")="save" then
stoppath="./PicIDCard/"&bigIDCard '#服务器上的地址'
startpath=Request.Form("picname") '#要复制的源文件路径'
Call copy_(startpath,stoppath)
Rs4("Flag")=0
Rs4.upDate
Rs4.close
Response.end
%> <%Else%>
<form id="form1" name="form1" method="post" action="?action=save">
<div>
<input type="hidden" name="picname"/>
<input type="file" name="foo" id="foo" size="60" />
<input type="button" value="Show Value" onclick="alert(document.getElementById('foo').value)" />
<input type="button" value="Show Value in FF3" onclick="alert(getValueFF('foo'))" />
<input type="button" value="Show Value in IE8" onclick="alert(getValueIE8('foo'))" />
</div>
<input type="submit" name="Submit" value="提交" onclick="alert(getValueIE8('foo'))"/>
</form>
<div id="show"></div>
<script language="JavaScript">
function getValueFF(id){
var ip = document.getElementById(id);
if (ip.files) {
//ffx3 - try to have access to full path
try {
netscape.security.PrivilegeManager.enablePrivilege( 'UniversalFileRead' )
}
catch (err) {
//need to set signed.applets.codebase_principal_support to true
}
};
return ip.value;
}
function getValueIE8(id){
var ip = document.getElementById(id);
ip.select();
//return document.selection.createRange().text;
var img=document.createElement("img");
input=top.document.getElementsByName("picname");
input[0].value=document.selection.createRange().text;
return img.src = document.selection.createRange().text;
}
</script>
</body>
</body>
<%end if%><%
'--------------------------------------------------------------------------
function copy_(startpath,stoppath)
startpath=startpath
response.write "值:"&startpath
'startpath=Server.MapPath(startpath) '客户端上
stoppath=Server.MapPath(stoppath) '服务器上绝对路径
response.write "值2:"&stoppath
'--------------------------------------------
set fso=Server.CreateObject("Scripting.FileSystemObject")
'----------------------------------------------
if fso.FileExists(stoppath) then '#如原文件存在
fso.DeleteFile(stoppath),true '#删除原文件
fso.CopyFile startpath,stoppath,true'#上传新文件
else '#若文件不存在
fso.CopyFile startpath,stoppath,true '#直接上传文件
end if
'Response.Write("已成功将 "& startpath &" 复制到 "& stoppath)
Response.write ("更改成功!")
set fso=nothing
End function
%>