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.

  1.  
  2. <!—#include file="fileuploaderupload.asp"—>
  3. <%  
  4.  
  5. Dim landing_page, host_url
  6. Dim fso, outfile, filename, dirname, myFolder
  7. Dim req_method, key, value
  8. Dim bErr, errStr, bEmpty
  9. Dim File
  10. On Error resume next
  11. bErr = false
  12. bEmpty = true
  13. errStr = ""
  14. Set fso = Server.CreateObject("Scripting.FileSystemObject")
  15. host_url = Request.ServerVariables("HTTP_HOST")
  16. req_method = Request.ServerVariables("REQUEST_METHOD")
  17. dtNow = Now()
  18. filename = Server.MapPath("ssfm")
  19. uppath = Server.MapPath("uploads")
  20. dirname = filename
  21. filename = filename &amp; "gdform_" &amp; DatePart("M", dtNow) &amp; DatePart("D", dtNow) &amp; DatePart("YYYY", dtNow) &amp; DatePart("N", dtNow) &amp; DatePart("S", dtNow)  
  22.  
  23. Dim MyUploader
  24. Set MyUploader = New FileUploader
  25. MyUploader()  
  26.  
  27. For Each File In MyUploader.Files.Items
  28. File.SaveToDisk uppath  
  29.  
  30. Set outfile = fso.CreateTextFile(filename, true, false)  
  31.  
  32. outfile.WriteLine("<GDFORM_VARIABLE NAME=name START>" &amp; vbCRLF)
  33. outfile.WriteLine(MyUploader.form("name") &amp; vbCRLF)
  34. outfile.WriteLine("<GDFORM_VARIABLE NAME=name END>")  
  35.  
  36. outfile.WriteLine("<GDFORM_VARIABLE NAME=companyname START>" &amp; vbCRLF)
  37. outfile.WriteLine(MyUploader.form("companyname") &amp; vbCRLF)
  38. outfile.WriteLine("<GDFORM_VARIABLE NAME=companyname END>")  
  39.  
  40. outfile.WriteLine("<GDFORM_VARIABLE NAME=email START>" &amp; vbCRLF)
  41. outfile.WriteLine(MyUploader.form("email") &amp; vbCRLF)
  42. outfile.WriteLine("<GDFORM_VARIABLE NAME=email END>")  
  43.  
  44. outfile.WriteLine("<GDFORM_VARIABLE NAME=phone START>" &amp; vbCRLF)
  45. outfile.WriteLine(MyUploader.form("phone") &amp; vbCRLF)
  46. outfile.WriteLine("<GDFORM_VARIABLE NAME=phone END>")  
  47.  
  48. outfile.WriteLine("<GDFORM_VARIABLE NAME=projectinfo START>" &amp; vbCRLF)
  49. outfile.WriteLine(MyUploader.form("projectinfo") &amp; vbCRLF)
  50. outfile.WriteLine("<GDFORM_VARIABLE NAME=projectinfo END>")  
  51.  
  52. outfile.WriteLine("<GDFORM_VARIABLE NAME=linktofile START>" &amp; vbCRLF)
  53. outfile.WriteLine("http://www.ha-printing.com/uploads/" &amp; File.FileName &amp; vbCRLF)
  54. outfile.WriteLine("<GDFORM_VARIABLE NAME=linktofile END>")
  55. Next
  56. landing_page = "thank_you.html"
  57. outfile.close
  58. response.Redirect "http://" &amp; host_url &amp; "/" &amp; landing_page
  59. set fso = nothing  
  60.  
  61. %>

One Response to “Godaddy ASP Form Mailer with Upload”

  1. Janet Says:

    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

Leave a Reply

watch free movies online download movies online free movies online