Riporto il codice corretto, ma continua darmi errori
questo
codice:
if nameConflict = "error" and GP_FileExist then
deve dare true perchè il messaggio di errore che mi si presenta è questo:
An error has occured saving uploaded file!
Filename: http://www.masterslab.com/applicatio...d/ZyWALL35.jpg
Maybe the destination directory does not exist, or you don't have write permission.
Please correct and try again
mentre il percorso è corretto.
codice:
'GP_curPath = Request.ServerVariables("PATH_INFO")
'GP_curPath = Trim(Mid(GP_curPath,1,InStrRev(GP_curPath,"/")) & UploadDirectory)
'if Mid(GP_curPath,Len(GP_curPath),1) <> "/" then
'GP_curPath = GP_curPath & "/"
'end if
'GP_CurFileName = UploadRequest.Item(GP_curKey).Item("FileName")
'GP_FullFileName = Trim(Server.mappath(GP_curPath))& "\" & GP_CurFileName
GP_curPath = "http://www.masterslab.com/applications/CatalogManager/image/"
GP_FullFileName = "http://www.masterslab.com/applications/CatalogManager/image/"
'Check if the file alreadu exist
GP_FileExist = false
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(GP_FullFileName)) Then
GP_FileExist = true
End If
if nameConflict = "error" and GP_FileExist then
Response.Write "File already exists!
"
Response.Write "Please correct and try again"
GP_strm1.Close
GP_strm2.Close
response.End
end if
if ((nameConflict = "over" or nameConflict = "uniq") and GP_FileExist) or (NOT GP_FileExist) then
if nameConflict = "uniq" and GP_FileExist then
Begin_Name_Num = 0
while GP_FileExist
Begin_Name_Num = Begin_Name_Num + 1
GP_FullFileName = Trim(Server.mappath(GP_curPath))& "\" & fso.GetBaseName(GP_CurFileName) & "_" & Begin_Name_Num & "." & fso.GetExtensionName(GP_CurFileName)
GP_FileExist = fso.FileExists(GP_FullFileName)
wend
UploadRequest.Item(GP_curKey).Item("FileName") = fso.GetBaseName(GP_CurFileName) & "_" & Begin_Name_Num & "." & fso.GetExtensionName(GP_CurFileName)
UploadRequest.Item(GP_curKey).Item("Value") = UploadRequest.Item(GP_curKey).Item("FileName")
end if
on error resume next
GP_strm2.SaveToFile GP_FullFileName,2
if err then
Response.Write "An error has occured saving uploaded file!
"
Response.Write "Filename: " & Trim(GP_curPath) & UploadRequest.Item(GP_curKey).Item("FileName") & "
"
Response.Write "Maybe the destination directory does not exist, or you don't have write permission.
"
Response.Write "Please correct and try again"
err.clear
GP_strm1.Close
GP_strm2.Close
response.End
end if
GP_strm1.Close
GP_strm2.Close
if storeType = "path" then
UploadRequest.Item(GP_curKey).Item("Value") = GP_curPath & UploadRequest.Item(GP_curKey).Item("Value")
end if
on error goto 0
end if
end if
next
End Sub