Solved

How to acheive with Dreamweaver 4: One click on text link, with two simultaneous actions taken

Posted on 2006-11-29
10
193 Views
Last Modified: 2010-04-25
With Dreamweaver 4, is it possible to click a text link on a page and have two things happen at once, in my case, initiate a download, AND send me an email automatically, without intervention from the user, with a small message saying "Download initiated"?
0
Comment
Question by:pigeonbr
  • 5
  • 3
  • 2
10 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 18039575
Hi pigeonbr,

You would need to get a scripting language involved to accomplish what you are asking for and this type of request isn't part of the DW built-in server behaviors.  It's a relatively simple process to have a link that goes to a PHP (for example) page that contains nothing but a script that does the following:

1. fire off the email to you
2. send the headers out for a download and then push the file
3. redirect the user to a landing page

We would need to know more about your hosting setup and scripting experience to help you further.

0
 

Author Comment

by:pigeonbr
ID: 18040149
Ok, I see the idea of how to acomplish this. I'm not good in HTML, but could you give me a short code sequence that would , say, show me how to send an automated email to an email address (EX: myemail@hotmail.com) with the following Subject OR message text: "Download initiated" for example? Thanks!
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 18040186
Which language?  PHP?  ASP?  ColdFusion?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:pigeonbr
ID: 18041217
jason, I'm not a web programmer...so either one of those is unfamiliar to me, but if you have some example I will study it...I'M a Visual C++ programmer by heart :) Just do some personal web stuff...nothing exotic so I never really need to learn much about PHP etc so far. Thanks for any help. Appreciate it. If you can't, that's ok as well. :)
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
ID: 18042301
I can, I just want to do something you'll actually find useful.  Here's the PHP:

<?php

// first, we set up the notification email

$to = "myemail@hotmail.com";
$subject = "Download Initiated";
$message = "What the subject says";
$from = "myemail@hotmail.com";

$header = "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset=iso-8859-1\r\n";

$headers .= "To: ".$to."\r\n";
$headers .= "From: ".$from."\r\n";
$headers .= "Reply-To: ".$from."\r\n";

// and now we send it

mail($to, $subject, $message, $header);

// next, push the download as a binary file

$file = '/path/to/file-to-download.xyz';
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize($filename));
header('Content-Disposition: attachment; filename=' . basename($file));
readfile($file);

// note:  pushing files can be accomplished in numerous ways.  The above may not be the best
// finally, redirect the user somewhere else

header("Location: http://www.yoursite.com/thanks.html");

?>
0
 
LVL 25

Expert Comment

by:Rouchie
ID: 18044070
If you are a C++ programmer then I really recommend you use ASP.NET and the C# language, rather than PHP (Jason - you offence meant...!)

I use VB as part of ASP.NET (the other main choice) so I can only offer limited help, but there are TONS of books and online articles showing how to do an infinite number of server-side things with C#.

http://www.c-sharpcorner.com/1/send_mai1l.asp

If you're new to it all though, start at the beginning.  The good thing about ASP.NET is that you don't need to know about HTML because that is all written for you.
0
 

Author Comment

by:pigeonbr
ID: 18045457
Thanks jason...I will study this carefully. It points me in the direction I was lookng for.

Roucjie, thanks for your comment as well. I have way too much on my plate at this moment to get into learning new things, but thanks for the advice! Appreciate it for sure.

Thank you both!
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 18047952
Rouchie,

I'm totally offended.

;)

Pigeonbr,

Ok, good luck.  I agree with Rouchie, though.  It will be an easier transition for you to go to ASP.NET than to PHP.  I didn't know you could embed C# via ASP.NET...
0
 
LVL 25

Expert Comment

by:Rouchie
ID: 18052183
>> I didn't know you could embed C# via ASP.NET...

There are TONS of languages you can choose from!  C# and VB are the most common, but the hardcore programmers are starting to use Python and Ruby.  

Here is a list http://www.dotnetpowered.com/languages.aspx  - PHP# is even on there, so now you've got to move over...!!

Given the extremely powerful object orientated approach (having the programming code in a seperate file that controls the page items' functionality), its a nice clean way to operate that keeps presentation away from the logic.

Reading that back anyone would think I work for Microsoft.  Totally not true, I still think their releases are all patch-tastic.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 18055558
>> PHP# is even on there, so now you've got to move over...!!

Not in this lifetime.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question