I'm creating a torrent platform (without tracker) and I have some problems while downloading the torrent from the server.
This is my part of the script:
$fn = dirname(__FILE__) . "/torrents/$id.torrent";
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$tname.torrent");
header("Content-Length: ".filesize($fn));
header("Content-Type: application/force-download");
header("Content-Transfer-Encoding: binary");
readfile($fn);
When I download the torrent throught this file (download.php in my case), torrent is not valid bencoding. What's the problem or what I have to do?