ユーザーがリンクをクリックして削除するたびに、画像ファイルを削除しようとしています。エラーは発生せず、エラー番号はゼロです。ただし、ファイルは削除されません。写真ファイルを保存できますが、何らかの理由で削除できません。これが私のコードです:
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)
-------------------------------------^