Please disregard the last one here is the code and error:
Error:
-------------
Server object
error 'ASP 0177 : 800704ec'
Server.CreateObject Failed
/process_form2.asp, line 29 800704ec
Code:
-----------------------
<<A href="mailto:%@LANGUAGE="VBSCRIPT">%@LANGUAGE="VBS CRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
</head>
<body>
<%
' Elham jan this is an updated demo I built to include ASPLOAD object which allows you
' to temporarily upload the file to the server before attaching justa demo of how
' the form is processed with minimal information. This object is something your ISP
' needs to have pre-installed on their server before it can work. Also you will need
' to have access to a directory that is temporary and is writable.
' ASPUPLOAD object is loaded
Set Upload = Server.CreateObject("Persits.Upload")
' UPLOAD MAX SIZE : We use memory uploads, so we must limit file size
Upload.SetMaxSize 1000000, True
' Save to memory. Path parameter is omitted
Upload.Save
' FROM info : Get the user fields from the page before. As an example I put two fields here : fromName and fromEmail
fromName= Upload.Form("fromName")
fromEmail= Upload.Form("fromEmail")
' SET UPLOAD PATH : You need a temporary location to upload the file. This directory needs to have write permissions for this to work
Path = "upload"
' UPLOAD TO PHYSICAL LOCATION : Save files to it. Our form has only one file item
' but this code is generic.
For Each File in Upload.Files
uploadfrom = File.Path
response.write("<hr>")
File.SaveAsVirtual Path & "/" & File.FileName
filepath=File.Path
response.write("File Temporarily Uploaded To : "&filepath)
response.write("<br>")
toAttachment= filepath
Next
response.write("<hr>")
' TO info : Who is this being emailed to goes here
toEmail= "
ellie@stecs.com"
' SUBJECT info : Whats the email subject?
toSubject= "Here is an email with attachment from "&fromName
' BODY info : What info that user filled in do we want to send?
toHTMLBody= "Hello.<br>" &_
" This is an email from "&fromName&". Here is more info :<Br/>"&_
" Email : "&fromEmail
'LET USER KNOW EMAIL WAS SENT SUCCESSFULY :
aftersuccessfulemail = " Dear "&fromNAme&", <Br><br>"&_
" Thank you for sending your info <br>"&_
" This is what we sent via email to :<b>"&toEmail&"</b><br>"&_
" From : <b>"&fromName&" ("&fromEmail&")</b><br>"&_
" Attached : <b>"&toAttachment&"</b>"
response.write(aftersuccessfulemail)
'BUILD EMAIL : Process the info gathered and send the user an email with attachment and fields
' PROCESS fromEmail
if trim(fromEmail)<>"" and trim(toEmail)<>"" then
Dim MyMail
Set MyMail = Server.CreateObject("CDO.Message")
MyMail.From = fromEmail
MyMail.To = toEmail
end if
' PROCESS toSubject
if trim(toSubject) <>"" then
MyMail.Subject = toSubject
end if
' PROCESS toHTMLBody
if trim(toHTMLBody) <>"" and toTEXTBody ="" then
MyMail.HTMLBody = toHTMLBody
end if
' PROCESS toAttachment
if trim(toAttachment)<>"" then
MyMail.AddAttachment(toAttachment)
end if
' PROCESS ALL
MyMail.Fields.Update()
' SEND email
MyMail.Send()
' 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(filepath)
response.write("<hr>")
response.write("Temporary file deleted : "&filepath)
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
' RESET everything
Set MyMail = Nothing
%>
</body>
</html>