Forum Moderators: coopster
$sql = "select * from table where tableID = $tableId";
$result = mysql_query($sql ,$db);
if ($myrow = mysql_fetch_array($result)) {
do {
$downloads = $myrow["downloads"] + 1;
} while ($myrow = mysql_fetch_array($result));
}
$sql = "update wallpaper set downloads = $downloads where tableID = $tableID";
$result = mysql_query($sql ,$db);
$newurl = "images/" . $size . "/" . $wallpaperid . ".jpg";
Header("Location: $newurl");
Use fread() to read the file and write the binary content to the page. Use the appropiate headers to then force the download / display of this file.
something like
$myvar = contents of file chosen (fread())
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"file.csv\"");
echo $myvar;
you could then change the filename to whatever you wanted.
check this link out for mimes
[w3schools.com...]
and this for fread()
[uk2.php.net...]
Ally