Ho scaricato vari script per effettuare ciò, ma tutti mi restituiscono il medesimo errore:
Cannot modify header information - headers already sent by (output started at c:\programmi\easyphp1-8\www\stream\download.php:19) in c:\programmi\easyphp1-8\www\stream\download.php on line 19
Questo è il codice del file download.php:
<?php
$filename = ( isset($_GET['file']) ) ? $_GET['file'] : '';
$folder = ( isset($_GET['folder']) ) ? $_GET['folder'] : '';
if ( $filename && $folder )// make sure there's data in them
{
$file_info = basename($filename);
$file_info = explode(".", $file_info);
$extension = $file_info[1];
// notice here, you can't insert a different url to add scripts since you always are adding / before anything gotten from the query string. There's many, and better, ways, to protect yourself, but this one works fine, and is simple.
$filename = 'http://www.ifeeder.net/' . $folder . '/' . $filename;
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/" . $extension );
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=".basename($filename).";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
readfile("$filename");
exit();
}
?>
Come risolvo???
Grazie