Web Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignWeb Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 7th, 2007, 04:17 PM
porcelain porcelain is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 1 porcelain User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m
Reputation Power: 0
Create a link that will start a download

I am relatively new to web design and I was wondering how you create a link that will initiate a download like the ones you find on software download sites. I have tried to look at the code from one to figure it out, but had no luck.

This is the code I tried to break down:
<a href="(URL address blocked: See forum rules)=10672637&merid=61683&mfgid=61683&ltype=dl_dlnow&lop=link&edId=3&siteId=4&oId=3040-2646_4-10672637&ontId=2646_4&destUrl=(URL address blocked: See forum rules)" onClick="return rbdl.dlNow('(URL address blocked: See forum rules)=link&ptype=3000&ontid=2646&siteId=4&edId=3&pid=10672637&psid=10041527','(URL address blocked: See forum rules)=10672637&merid=61683&mfgid=61683&ltype=dl_dlnow&lop=link&edId=3&siteId=4&oId=3040-2646_4-10672637&ontId=2646_4&destUrl=(URL address blocked: See forum rules))" class="download" onMouseOver="document.dln.src='(URL address blocked: See forum rules)" onMouseOut="document.dln.src='(URL address blocked: See forum rules)">

Reply With Quote
  #2  
Old May 8th, 2007, 02:34 AM
Humanetainit's Avatar
Humanetainit Humanetainit is offline
Beyond help
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Location: The Netherlands
Posts: 223 Humanetainit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 32 m 30 sec
Reputation Power: 2
PHP Code:
<?php
        $filename 
$_SERVER["DOCUMENT_ROOT"] . '/downloads/' eregi_replace("[^a-zA-Z0-9\\._-]"""$_GET['filename']);
        
// required for IE, otherwise Content-disposition is ignored
        
if(ini_get('zlib.output_compression')) {
        
ini_set('zlib.output_compression''Off');
        }
        
header("Pragma: public"); // required
        
header("Expires: 0");
        
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        
header("Cache-Control: private",false); // required for certain browsers 
        
header("Content-Type: image/jpg");
        
header("Content-Disposition: attachment; filename=" basename($filename) . ";" );
        
header("Content-Transfer-Encoding: binary");
        
header("Content-Length: " filesize($filename));
        
readfile($filename);
?>

If you send the file name to this file (put this code in dl.php, i.e.), via GET or POST (if you use POST, change this file accordingly). The regex makes sure only these: a-zA-Z0-9._- are valid characters and strips the rest. No spaces or text before <?php.

Example: <a href="dl.php?filename=movie.avi">download me!</a>

This should work a treat.
__________________
One World... Humanetainit | Program secure

Reply With Quote
  #3  
Old June 15th, 2007, 12:43 PM
monibuvy monibuvy is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2007
Posts: 1 monibuvy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 21 sec
Reputation Power: 0
Ooor <a href="download.exe">Download</a>. That will pop up a download box and not redirect to any other page than the link. That link you were looking at is probably for security.

You don't need anything other than html for download links..

BTW, WHY did i get an email from this website even though i clicked NOT to? that's called spam and i think it's illigal.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignWeb Development > Create a link that will start a download


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT