Solved

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

Posted on 2006-11-29
10
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

688 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