file downloads
| From: | Data Driven Design | Date: | Sat, 04 Aug 2001 15:55:35 +0000 |
| Subject: | file downloads | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-61244@lists.php.net to get a copy of this message | ||
Why does this code produce a page cannot be displayed error?
<?php
mysql_connect("localhost","username","password");
mysql_select_db("database");
$query = "SELECT file_path from photos where photos_id=$photos_id";
$result = @mysql_query("$query");
$row = mysql_fetch_row($result);
$path = $row[0];
$parts = split("/",$path);
$file_name = $parts[count($parts)-1];
header("Content-Type: application/download\n");
header("Content-Disposition: attachment; filename=$file_name");
header("Content-Transfer-Encoding: binary");
$fn=fopen($path , "r");
fpassthru($fn);
?>
Data Driven Design
1506 Tuscaloosa Ave
Holly Hil, FL 32117
http://www.datadrivendesign.com
http://www.rossidesigns.net