Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Creating a download link
Old 05-29-2007, 02:13 PM Creating a download link
PadraigCurran's Avatar
Skilled Talker

Posts: 59
Name: Padraig Curran
Location: Ireland
Trades: 0
Hello.

I was wondering how you create a download link. For example if someone wanted to download a (X)HTML and CSS file that was zipped up, how would I code this.

Thanks,
Padraig.
__________________

Please login or register to view this content. Registration is FREE
- I am available for web design work!
PadraigCurran is offline
Reply With Quote
View Public Profile Visit PadraigCurran's homepage!
 
 
Register now for full access!
Old 05-29-2007, 02:42 PM Re: Creating a download link
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Like any other link:
<a href="file.zip">Download zip file</a>
Browsers know to download a zip file and not try to open it.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 05-29-2007, 03:00 PM Re: Creating a download link
PadraigCurran's Avatar
Skilled Talker

Posts: 59
Name: Padraig Curran
Location: Ireland
Trades: 0
I got it working.

Thanks LadynRed!!
__________________

Please login or register to view this content. Registration is FREE
- I am available for web design work!
PadraigCurran is offline
Reply With Quote
View Public Profile Visit PadraigCurran's homepage!
 
Old 05-25-2009, 07:04 PM Re: Creating a download link
kcmartz's Avatar
Super Talker

Latest Blog Post:
~Gri to Kcmartz~
Posts: 120
Name: Kenson
Location: Washington, USA
Trades: 0
I would like the same basic type of help, but it is a .wma file.., please help!
__________________
Thanks,

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
for problems/site.
kcmartz is offline
Reply With Quote
View Public Profile Visit kcmartz's homepage!
 
Old 05-26-2009, 03:50 PM Re: Creating a download link
Novice Talker

Posts: 7
Trades: 0
ZIP files do not open on browsers, so simply put a regular link to the .zip file and it will work
__________________
TeraDepot.com - File Hosting, Storage & Sharing
Register Today !!!

Please login or register to view this content. Registration is FREE
teradepot is offline
Reply With Quote
View Public Profile
 
Old 05-26-2009, 05:53 PM Re: Creating a download link
Skilled Talker

Posts: 84
Trades: 0
If you haven't set this in your mime type or in your handling files list it should ask to open/save this file when you take it in your browser I think.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
- 1-888-869-HOST(4678)
Award winning Managed Hosting -
Please login or register to view this content. Registration is FREE

Managed Dedicated Servers. Reseller Discounts. 24/7 Impressive Tech Support
HivelocityDD is offline
Reply With Quote
View Public Profile
 
Old 05-27-2009, 05:32 PM Re: Creating a download link
Junior Talker

Posts: 3
Trades: 0
Quote:
Originally Posted by kcmartz View Post
I would like the same basic type of help, but it is a .wma file.., please help!
Should be the same procedure...
kjeder is offline
Reply With Quote
View Public Profile
 
Old 06-17-2009, 06:03 PM Re: Creating a download link
kcmartz's Avatar
Super Talker

Latest Blog Post:
~Gri to Kcmartz~
Posts: 120
Name: Kenson
Location: Washington, USA
Trades: 0
I tried and gave up, I did something similar to this:

<a href="videoname.wma">Podcast 1</a>

and nothing happened, tried playing in browser
__________________
Thanks,

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
for problems/site.
kcmartz is offline
Reply With Quote
View Public Profile Visit kcmartz's homepage!
 
Old 06-18-2009, 11:29 PM Re: Creating a download link
GeekSpecialties's Avatar
Super Talker

Posts: 132
Name: Leonard
Location: Minnesota, USA
Trades: 0
If you have PHP available here are a couple of options.

http://www.finalwebsites.com/snippets.php?id=4
http://www.ironclad.net/scripts/

Here is a version similar to the first link I use, set up for pdf extension.
To alter for other types alter $extenstion=
and Content-type:
and folder where content is /pdf/
Code:
<?php
// place this code inside a php file and call it f.e. "download.php"
$filename = $_GET['file'];
$extension = ".pdf";
$path = $_SERVER['DOCUMENT_ROOT']."/pdf/"; // play with the path if the document root does noet exist
$fullPath = $path . $filename . $extension;
if ($fd = fopen ($fullPath, "r")) {
    $fsize = filesize($fullPath);
    $path_parts = pathinfo($fullPath);
    $ext = strtolower($path_parts["extension"]);
    switch ($ext) {
        case "pdf":
        header("Content-type: application/pdf"); // add here more headers for diff. extensions
        header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachement' to force a download
        break;
        default;
        header("Content-type: application/octet-stream");
        header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
    }
    header("Content-length: $fsize");
    header("Cache-control: private"); //use this to open files directly
    while(!feof($fd)) {
        $buffer = fread($fd, 2048);
        echo $buffer;
    }
}
fclose ($fd);
exit;
//link to file example: http://www.example.com/download.php?file=file-name
?>

Last edited by GeekSpecialties; 06-18-2009 at 11:33 PM..
GeekSpecialties is offline
Reply With Quote
View Public Profile Visit GeekSpecialties's homepage!
 
Reply     « Reply to Creating a download link
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.51210 seconds with 12 queries