Page 1 of 1

How to get the filename to download?

Posted: Tue Mar 11, 2014 4:28 am
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>";
  }

Re: How to get the filename to download?

Posted: Tue Mar 11, 2014 7:17 am
by Celauran
At a glance that looks right. What isn't working?