我有从服务器下载种子文件的脚本:
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private");
header("Content-Description: File Transfer");
header("Content-Type: application/x-bittorrent");
header('Content-Length: '.filesize($local));
header("Content-Disposition: attachment; filename=\"".$local."\"");
$file = fopen($local, "r");
print fread($file, filesize($local));
fclose($file);
如果我下载文件,torrent 已损坏且无法使用,任何人都可以帮助我吗?错误是:
Torrent文件解码失败!请尝试重新下载种子!
编辑:
$path = 'torrent/';
$local = $path.$row['file_src'];
我做些小改动
header('Cache-control: private');
header('Content-Type: application/x-bittorrent');
header('Content-Length: '.filesize($local));
header('Content-Disposition: filename='.$download);
$file = fopen($local, "r");
print fread($file, filesize($local));
fclose($file);
编辑: 抱歉,但总的来说这不是问题,谢谢@deceze,问题出在 torrent 文件中,下载后有一行。我怎样才能修复这个?