【发布时间】:2015-07-04 08:57:51
【问题描述】:
我有从服务器下载种子文件的脚本:
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 文件中,下载后有一行。我该如何修复它?
【问题讨论】:
-
“torrent 已损坏”是什么意思?文件包含什么?给我们看一看!还是只是种子不再可用?
-
种子文件解码失败!请尝试重新下载种子!
-
你能确认你所有的标题都是正确的吗?您的过期值可能是 > 0 但低于时间的值?您还需要在最后的
header行上使用不同的引号,因为标题包含在"中,但您的文件名需要包含在'引号中,而不是更多“。 -
我做了一点改动 header('Cache-control: private'); header('Content-Type: application/x-bittorrent'); header('内容长度:'.filesize($local)); header('Content-Disposition: filename='.$download); $file = fopen($local, "r"); // otwieramy nasz lokalny plik print fread($file, filesize($local)); // wrzucamy do przeglÄ...darki odczyt, czyli wywoĹ‚ujemy Ĺ›ciÄ...gniÄ™cie fclose($file);
-
我的问题是:下载的文件包含什么。如果你双击它不会发生什么。为什么不能直接进去看看?看看发生了什么?