Solved

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

Posted on 2006-11-29
10
190 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 …
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

706 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

18 Experts available now in Live!

Get 1:1 Help Now