Advertisement

04.13.2007 at 06:30AM PDT, ID: 22509545
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

Upload an image on form and email it

Asked by stone5150 in Macromedia Dreamweaver

Tags: , , , ,

I downloaded Pure ASP file upload from www.motobit.com and used a script from pantyboy's Q at http://www.experts-exchange.com/Web_Development/Software/Macromedia_Dreamweaver/Q_22482550.html but when I try it I get a blank page.

Am I missing something?

Script
~~~~~~~~~~~~~~~~~
<%
' Sample file Form-Email.asp
' Let's you send one an email with one or more attachments.
' Original code from http://www.motobit.com/help/scptutl/upload.asp
' Alteration of code to use CDOSYS instead of CDONTS by fuzzboxer at Experts Exchange
' See http://www.experts-exchange.com/Web_Development/Software/Macromedia_Dreamweaver/Q_22482550.html

'Global declarations.
'Get temporary folder
Dim ResultHTML

'Create upload form
'Using Huge-ASP file upload
'Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm")
'Using Pure-ASP file upload
Dim Form: Set Form = New ASPForm %><!--#INCLUDE FILE="_upload.asp"--><%

Server.ScriptTimeout = 1000
'Do not upload data greater than 10MB.
Form.SizeLimit = &HA00000

'Progress bar window will receive the same ID.
Form.UploadID = Request.QueryString("UploadID")'{/b}

Const fsCompletted  = 0

If Form.State = fsCompletted Then 'Completted
  ResultHTML = ProcessForm
ElseIf Form.State > 10 then
  Const fsSizeLimit = &HD
  Select case Form.State
            case fsSizeLimit: ResultHTML = "<br><Font Color=red>Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)</Font><br>"
            case else ResultHTML = "<br><Font Color=red>Some form error.</Font><br>"
  end Select
End If

if request.QueryString("Action") = "Cancel" then
      ResultHTML = "<br><b>Upload was cancelled</b>"
end if

Function TempFolder()
      Dim FS
  Set FS = CreateObject("Scripting.FileSystemObject")
  'Get temporary folder
  TempFolder = FS.GetSpecialFolder(2) & "\emailtemp"
End Function

Sub DeleteFile(FileName)
      Dim FS
  Set FS = CreateObject("Scripting.FileSystemObject")
      FS.DeleteFile FileName
End Sub

Function ProcessForm
  Dim eName, eAddress, ePostcode, ePhone, eMail, eStory

  'get source form fields - From, To, Subject, Message etc.
  eName = Form("Name")
  eAddress = Form("Address")
  ePostcode = Form("PostCode")
  ePhone = Form("PhoneNumber")
  eMail = Form("EmailAddress")
  eStory = Form("Story")
 
  Dim HTML
  HTML = "<br><span style='color:red'>Server-side ASP script accepted source form with fields and files and email object was created. "
  HTML = HTML & "<br>From: <b>" & eName & "</b>"
  HTML = HTML & "<br>Address: <b>" & eAddress & "</b>"
  HTML = HTML & "<br>Postcode: <b>" & ePostcode & "</b>"
  HTML = HTML & "<br>Phone: <b>" & ePhone & "</b>"
  HTML = HTML & "<br>Email: <b>" & eMail & "</b>"
  HTML = HTML & "<br>Story: <b>" & eStory & "</b>"

  Dim objNewMail, File, FileName

  'Create a new email message
 Set objNewMail = CreateObject("CDO.Message")
  objNewMail.To = "name@domain.com" ' Change this to your recipient
  objNewMail.From = "name@domain.com" ' Change this to your poster
  objNewMail.Subject = "From the Website" ' Change this to your subject line
  'Save source files to temporary folder
  'Add these files to the new e-mail
      HTML = HTML & "<br>Attachments:"
  For Each File In Form.Files.Items

    'If source file is specified.
    If Len(File.FileName) > 0 Then

              HTML = HTML & "<br>&nbsp;" & File.Name & ": <b>" & File.FileName & ", " & File.Length \ 1024 & "kB</b>"
      FileName = TempFolder & "\" & File.FileName
   
      File.SaveAs FileName
     
      objNewMail.AddAttachment FileName
    End If
  Next
 
  'Send the new email
  objNewMail.HtmlBody = HTML
  objNewMail.Send
 
  Response.Redirect("ThankYou.asp") ' Change this to your page name
 
  Set objNewMail=nothing
 
  'delete temporary files
  For Each File In Form.Files.Items
    If Len(File.FileName) > 0 Then
      FileName = TempFolder & "\" & File.FileName
      on error resume next
      DeleteFile FileName
    End If
  Next
  HTML = HTML & "</Font><br>"
  ProcessForm = HTML
End Function

'{b}get an unique upload ID for this upload script and progress bar.
Dim UploadID, PostURL
UploadID = Form.NewUploadID

'Send this ID as a UploadID QueryString parameter to this script.
PostURL = Request.ServerVariables("SCRIPT_NAME") & "?UploadID=" & UploadID'{/b}
%>
Start Free Trial
[+][-]04.13.2007 at 06:38AM PDT, ID: 18905239

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.13.2007 at 07:05AM PDT, ID: 18905426

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.13.2007 at 07:43AM PDT, ID: 18905728

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.13.2007 at 07:58AM PDT, ID: 18905908

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.13.2007 at 09:38AM PDT, ID: 18906784

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.13.2007 at 10:08AM PDT, ID: 18907014

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.13.2007 at 10:45AM PDT, ID: 18907291

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.13.2007 at 02:07PM PDT, ID: 18908529

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.13.2007 at 03:18PM PDT, ID: 18908873

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Macromedia Dreamweaver
Tags: upload, form, dreamweaver, image, email
Sign Up Now!
Solution Provided By: Pantyboy
Participating Experts: 4
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32