How to get the filename to download?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
weixin268
Forum Newbie
Posts: 15
Joined: Mon Feb 17, 2014 12:53 am

How to get the filename to download?

Post by weixin268 »

How to get the filename from MySQL to download file? Thanks!

Code: Select all

$filepath = "C:/upload";
$sql = "SELECT date_format(uploaddate,'%c/%e/%y') as formatted_date, topic, filename from upload order by uploaddate desc";

        $result = mysql_query($sql);
        while($row = mysql_fetch_row($result))
        {
                 echo "$row[0],$row[1],<a href=\"upload/$row[2]\">(Download)</a><br><br>";
  }
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: How to get the filename to download?

Post by Celauran »

At a glance that looks right. What isn't working?
Post Reply