Godaddy ASP Form Mailer with Upload
This is merely an expansion on this blog post: http://www.asp101.com/articles/jacob/scriptupload.asp
You will need to download the asp script from there for this to work. You’ll also need to specify a writable directory named uploads.
The script below is for anyone using godaddy and cannot get gdform.asp to send you an email AND upload a file. It emails you a link to the file after it uploads along with form fields.
-
-
<!—#include file="fileuploaderupload.asp"—>
-
<%
-
-
Dim landing_page, host_url
-
Dim fso, outfile, filename, dirname, myFolder
-
Dim req_method, key, value
-
Dim bErr, errStr, bEmpty
-
Dim File
-
On Error resume next
-
bErr = false
-
bEmpty = true
-
errStr = ""
-
Set fso = Server.CreateObject("Scripting.FileSystemObject")
-
host_url = Request.ServerVariables("HTTP_HOST")
-
req_method = Request.ServerVariables("REQUEST_METHOD")
-
dtNow = Now()
-
filename = Server.MapPath("ssfm")
-
uppath = Server.MapPath("uploads")
-
dirname = filename
-
filename = filename & "gdform_" & DatePart("M", dtNow) & DatePart("D", dtNow) & DatePart("YYYY", dtNow) & DatePart("N", dtNow) & DatePart("S", dtNow)
-
-
Dim MyUploader
-
Set MyUploader = New FileUploader
-
MyUploader()
-
-
For Each File In MyUploader.Files.Items
-
File.SaveToDisk uppath
-
-
Set outfile = fso.CreateTextFile(filename, true, false)
-
-
outfile.WriteLine("<GDFORM_VARIABLE NAME=name START>" & vbCRLF)
-
outfile.WriteLine(MyUploader.form("name") & vbCRLF)
-
outfile.WriteLine("<GDFORM_VARIABLE NAME=name END>")
-
-
outfile.WriteLine("<GDFORM_VARIABLE NAME=companyname START>" & vbCRLF)
-
outfile.WriteLine(MyUploader.form("companyname") & vbCRLF)
-
outfile.WriteLine("<GDFORM_VARIABLE NAME=companyname END>")
-
-
outfile.WriteLine("<GDFORM_VARIABLE NAME=email START>" & vbCRLF)
-
outfile.WriteLine(MyUploader.form("email") & vbCRLF)
-
outfile.WriteLine("<GDFORM_VARIABLE NAME=email END>")
-
-
outfile.WriteLine("<GDFORM_VARIABLE NAME=phone START>" & vbCRLF)
-
outfile.WriteLine(MyUploader.form("phone") & vbCRLF)
-
outfile.WriteLine("<GDFORM_VARIABLE NAME=phone END>")
-
-
outfile.WriteLine("<GDFORM_VARIABLE NAME=projectinfo START>" & vbCRLF)
-
outfile.WriteLine(MyUploader.form("projectinfo") & vbCRLF)
-
outfile.WriteLine("<GDFORM_VARIABLE NAME=projectinfo END>")
-
-
outfile.WriteLine("<GDFORM_VARIABLE NAME=linktofile START>" & vbCRLF)
-
outfile.WriteLine("http://www.ha-printing.com/uploads/" & File.FileName & vbCRLF)
-
outfile.WriteLine("<GDFORM_VARIABLE NAME=linktofile END>")
-
Next
-
landing_page = "thank_you.html"
-
outfile.close
-
response.Redirect "http://" & host_url & "/" & landing_page
-
set fso = nothing
-
-
%>
March 21st, 2009 at 8:50 pm
I am not a savy programmer. I just have a small site for my parties and I want to have a form that can upload pictures to my email.
I saw your post about that and am totally confused.
Could you please give me step-by-step on how to do it?
I am using GoDaddy and Dreamweaver. Any help you can give me in plain english would be greatly appreciated!!
–Janet