Jump to content

Download a file with PHP


george_king

Recommended Posts

Just a basic file.

<a href="yourfile" >Name</a>

 

 

if the file name changes:

<?php
$file_name = $row['yourfile']; //Where ever you are pulling the file from wether it is a database or 

echo '<a href="'.$file_name.'" >'.$file_name.'</a>'; 
?>

 

It would help to know more information about what you are doing.

I think whure looking for is how to force download... just google "php force download" there are a bunch of different ways.. but basic concept is

using headers making the its content-type an application so that the browser doesnt try to parse or read the file, whether its html, or php or whatever it may be.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.