Solved

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

Posted on 2006-11-29
10
191 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dreamweaver Styles 7 396
Wrapping 2 Divs in a Container 8 561
Dreamweaver CC no database behaviors or connections possible ? 10 3,802
Coldfusion connection with xampp2 5 225
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…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

929 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now