Php
Run on a different page he will report the downloaded image without the error but my picture exists
The name of the English picture can be but the name of the Chinese image of the paper does not exist why? Help to correct ....
The showpicture.php page is as follows:
Untitled Document
Click to download
Click to download
$str = UrlEncode ("shunping. jpg");
echo "Click to download"
?>
Click to download
The downpicture.php page is as follows:
Header ("Expires:-1");
Header ("Cache-control:no_cache");
Header ("Pragma:no-cache");
Header ("content-type:text/html; Charset=utf-8 ");
Require ' class/filedown.class.php ';
$name =urldecode ($_request["name"]);
Echo $name;
Down_file ($name, "/mianxiangduixiang/down/");
?>
The fileDown.class.php page is as follows:
Header ("Expires:-1");
Header ("Cache-control:no_cache");
Header ("Pragma:no-cache");
Header ("content-type:text/html; Charset=utf-8 ");
function Down_file ($file _name, $file _sub_dir)
{
$file _name=iconv ("gb2312", "GBK", $file _name);
$file _path = $_server[' Document_root '). $file _sub_dir. $file _name;
if (!file_exists ($file _path))
{
echo "file does not exist";
return;
}
$fp = fopen ($file _path, "R");
$file _size = filesize ($file _path);
Header ("Content-type:application/octet-stream");
Header ("Accept-ranges:bytes");
Header ("Accept-length: $file _size");
Header ("content-disposition:attachment; Filename= ". $file _name);
$buffer = 1024;
$file _count = 0;
while (!feof ($fp) && ($file _size-$file _count>0))
{
$file _data = fread ($fp, $buffer);
$file _count+= $buffer;
echo $file _data;
}
Fclose ($FP);
}
?>