每当用户单击链接以将其删除时,我都会尝试删除图像文件。我没有错误,错误号为零。但是,该文件不会被删除。我可以保存照片文件,但由于某种原因不能删除它们。这是我的代码:
PhotoFile = "\images\networkPartners\" & rs(fieldName)
PhotoPath = Server.MapPath(PhotoFile)
dim ServerFSO
Set ServerFSO=Server.CreateObject("Scripting.FileSystemObject")
if ServerFSO.FileExists(PhotoPath) then
response.Write(PhotoPath)
ServerFSO.DeleteFile(PhotoPath)
end if
set ServerFSO=nothing
当 response.write 命中时,我得到了实际的文件路径。(“C:/web/images”等)一直到文件名。所有的大小写都是正确的等等。同样,当我执行“on error resume next”并写出错误号和字符串时,完全没有错误。
来电:
ServerFSO.DeleteFile(PhotoPath, true)
导致错误:
Microsoft VBScript compilation error '800a0414'
Cannot use parentheses when calling a Sub
/folder/file_edit.asp, line 32
ServerFSO.DeleteFile(PhotoPath, true)
-------------------------------------^