Hi guys,
I am trying to delete a file from server, but it seems my codes doesn't do any thing and still file is in erver. Could you please help me where I am wrong?
Many thanks,
Elham
------------------- code ----------------------
<%
Set Upload = Server.CreateObject("Persits.Upload")
Count = Upload.Save("C:\Inetpub\wwwroot\stecs-dev\contact\")
Response.Write Count & " file(s) uploaded to C:\Inetpub\wwwroot\stecs-dev\contact\"
Response.write("<hr>")
%>
<%
SUB sendmail( fromWho, toWho, AddAttachment1, Subject, Body )
Dim objCDO
Dim iConf
Dim Flds
Const cdoSendUsingPort = 2
Set objCDO = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "stecs-exchange.stecs.com"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPconnectiontimeout) = 10
.Update
End With
Set objCDO.Configuration = iConf
objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.AddAttachment AddAttachment1
objCDO.TextBody = "CONTACT INFORMATION" & vbCrLf & "____________________" & vbCrLf &_
"Name: " & firstname & vbCrLf & "Company: " &company & vbCrLf &_
"Address: " & Address & vbCrLf & "City: " &city & ", "& state & " " &zip & vbCrLf &_
"Country: " &country & vbCrLf & "phone: " &phone & vbCrLf & "My Message : " & myMessage & vbCrLf & "How did you hear about us? " & Body
objCDO.Send
ConfirmMsg = Response.redirect("thankyou.html")
END SUB
Dim Domainname
Dim MailServer
Dim From
Dim subject1
Domainname = "webdev.stecs.com"
MailServer = Upload.Form("MailServer")
subject1 = "IDS-7934969 - "
fromWho = Upload.Form( "fromWho")
'toWho = Upload.Form( "toWho") + "@stecs.com"
toWho = "
resumes@stecs.com"
AddAttachment1= Upload.Files("toAttachment").path
firstname = TRIM( Upload.Form( "Name" ) )
company = TRIM( Upload.Form( "Company" ) )
address = TRIM( Upload.Form( "Address" ) )
city = TRIM( Upload.Form( "City" ) )
state = TRIM( Upload.Form( "State" ) )
zip = TRIM( Upload.Form( "Zip" ) )
country = TRIM( Upload.Form( "Country" ) )
phone = TRIM( Upload.Form( "Phone" ) )
myMessage = TRIM( Upload.Form( "MyMessage" ) )
Subject = TRIM( Upload.Form( "Subject" ) )
Body = TRIM( Upload.Form( "Body") )
send_mail = Upload.Form( "send_mail")
If send_mail <> "" THEN
sendMail fromWho, toWho, AddAttachment1, Subject, Body
'Cleanup
Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
END IF
' DETLETE UNNEEDED FILE AFTER UPLOADING
Dim myFSO
'this line creates an instance of the File Scripting Object named myFSO
SET myFSO = Server.CreateObject("Scripting.FileSystemObject")
'error handling here to make sure that things go smoothly
'if the file does not exist
If myFSO.FileExists(filepath) Then
'then we delete it
myFSO.DeleteFile(AddAttachment1)
response.write("<hr>")
response.write("Temporary file deleted : "&AddAttachment1)
Else
'otherwise we tell the client it does so they don't get a nasty error
Response.Write "THIS FILE DOESN'T EXISTS"
End If
'this line destroys the instance of the File Scripting Object named myFSO
SET myFSO = NOTHING
%>