Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email error on upload page

Status
Not open for further replies.

tekyge

Programmer
Dec 11, 2005
125
US
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
%>
 
Read the error.

It says that the variable myMail is undefined.

Maybe you should define it ;-)

If you're not sure how to do that, you should read up on ASP at and search google for "dim variables ASP"



A smile is worth a thousand kind words. So smile, it's easy! :)
 
I did define it

Dim myMail with no success thats why I ask for help.
 

where...?


A smile is worth a thousand kind words. So smile, it's easy! :)
 

gives this error

006~ASP 0206~Cannot call BinaryRead~Cannot call BinaryRead after using Request.Form collection.
 
This is a different error.

I'm assuming you dim'ed your mymail variable now?

The second and new error (which should be raised in a new thread) is because you cannot access the form directly (e.g. request.form("myvar") ) before you do a binary read to get the attachments and vice versa. Basically reading in binary mode or through the collection are mutually exclusive.. it's an either/or situation.

It looks like you run SaveFiles after you've sent the email, but don't show that code above. My suggestion is you run it first, then use FreeASPUploads built in features to return the name of the attachment(s). In fact if you search in this forum (use the search button) then you will find information on doing exactly that, though I would recommend you start at the FreeASPUpload site:



A smile is worth a thousand kind words. So smile, it's easy! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top