Below is the code I am using and it works great except for this error, and the error started when I tried to add the email funtion can anyone help?
Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'myMail'
/client_services/upload/thanks.asp, line 52
<%@ Language=VBScript %>
<%
option explicit
Response.Expires = -1
Server.ScriptTimeout = 600
%>
<!-- #include file="upload.asp" -->
<%
uploadsDirVar = "C:\Inetpub\
function OutputForm()
%>
<%
end function
function SaveFiles
Dim Upload, fileName, fileSize, ks, i, fileKey
Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)
' If something fails inside the script, but the exception is handled
If Err.Number<>0 then Exit function
SaveFiles = ""
ks = Upload.UploadedFiles.keys
if (UBound(ks) <> -1) then
SaveFiles = "<B>Files uploaded:</B> "
for each fileKey in Upload.UploadedFiles.keys
SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & "B) "
next
else
SaveFiles = "The file name specified in the upload form does not correspond to a valid file in the system."
end if
SaveFiles = SaveFiles & "<br>Enter a number = " & Upload.Form("enter_a_number") & "<br>"
end function
'-- Start Of Email
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Support-Team"
myMail.From="upload_processing@mydomain.com"
myMail.To="support@mydomain.com"
myMail.TextBody="" & vbcrlf & vbcrlf & _
"Upload-Processing" & vbcrlf & _
"----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----" & vbcrlf & _
"----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----" & vbcrlf & _
"Account ID: " & Request.Form("enter_a_number") & vbcrlf & _
"File 1: & Request.Form("attach1") & vbcrlf & _
"File 2: & Request.Form("attach2") & vbcrlf & _
"File 3: & Request.Form("attach3") & vbcrlf & _
"File 4: & Request.Form("attach4")
myMail.Send
set myMail=nothing
'-- End Of Email
%>
Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'myMail'
/client_services/upload/thanks.asp, line 52
<%@ Language=VBScript %>
<%
option explicit
Response.Expires = -1
Server.ScriptTimeout = 600
%>
<!-- #include file="upload.asp" -->
<%
uploadsDirVar = "C:\Inetpub\
function OutputForm()
%>
<%
end function
function SaveFiles
Dim Upload, fileName, fileSize, ks, i, fileKey
Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)
' If something fails inside the script, but the exception is handled
If Err.Number<>0 then Exit function
SaveFiles = ""
ks = Upload.UploadedFiles.keys
if (UBound(ks) <> -1) then
SaveFiles = "<B>Files uploaded:</B> "
for each fileKey in Upload.UploadedFiles.keys
SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & "B) "
next
else
SaveFiles = "The file name specified in the upload form does not correspond to a valid file in the system."
end if
SaveFiles = SaveFiles & "<br>Enter a number = " & Upload.Form("enter_a_number") & "<br>"
end function
'-- Start Of Email
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Support-Team"
myMail.From="upload_processing@mydomain.com"
myMail.To="support@mydomain.com"
myMail.TextBody="" & vbcrlf & vbcrlf & _
"Upload-Processing" & vbcrlf & _
"----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----" & vbcrlf & _
"----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----" & vbcrlf & _
"Account ID: " & Request.Form("enter_a_number") & vbcrlf & _
"File 1: & Request.Form("attach1") & vbcrlf & _
"File 2: & Request.Form("attach2") & vbcrlf & _
"File 3: & Request.Form("attach3") & vbcrlf & _
"File 4: & Request.Form("attach4")
myMail.Send
set myMail=nothing
'-- End Of Email
%>