Ora si che ci siamo..
Codice PHP:
function forceDownload( &$file ) {
/**
* Function forceDownload:
* download any type of file if it exists and is readable
* -------------------------------------
* @author Andrea Giammarchi
* @date 18/01/2005 [13/04/2005]
* @compatibility PHP >= 4.3.0
*/
if( file_exists( $file ) == true && is_readable( $file ) == true ) {
$filename = &basename( $file );
if( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) {
$parsename = &explode( '.', $filename );
$last = count( $parsename ) - 1;
$filename = &implode( '%2E', array_slice( $parsename, 0, $last ) );
$filename .= '.'.$parsename[$last];
}
$content = &file_get_contents( $file );
header( 'Content-Type: application/octet-stream' );
header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
header( 'Content-Length:'.strlen( $content ) );
header( 'Content-Transfer-Encoding: binary' );
echo $content;
exit(0);
}
}
Andr3a sei grande!!!!!