www.gusucode.com > Tatter Tools 0.961 SE GB2312 简体中文版 > upload/down.php
<? include("inc_global.php"); include("inc_function.php"); $sql = "select pno, filename, filesize from t3_".$dbid."_files where attachname = '$attachname'"; list ($pno, $filename, $filesize) = mysql_fetch_array(mysql_query($sql)); if ($pno) { $sql = "select image_file_path1, image_file_path2 from t3_".$dbid." where no = '$pno'"; list ($image_file_path1, $image_file_path2) = mysql_fetch_array(mysql_query($sql)); } else { $sql = "select pno, filename, filesize from t3_".$dbid."_keyword_files where attachname = '$attachname'"; list ($pno, $filename, $filesize) = mysql_fetch_array(mysql_query($sql)); $sql = "select image_file_path1, image_file_path2 from t3_".$dbid."_keyword where no = '$pno'"; list ($image_file_path1, $image_file_path2) = mysql_fetch_array(mysql_query($sql)); } if (!$pno) exit; header("Content-Disposition: attachment; filename=\"$filename\""); header("Content-Transfer-Encoding: binary"); header("Accept-Ranges: bytes"); header("Content-Length: $filesize"); header("Connection: close"); header("Content-type: application/octet-stream"); if ($fp = fopen("attach/$image_file_path1$image_file_path2$attachname", "r")) { while(!feof($fp)) { $str = fread($fp, 1024); print $str; } fclose($fp); } ?>