Ho provato ad inserire il codice che mi hai postato,
ma non ho risolto.
Non mi dà errore, ma nella mascherina che mi si apre,
dove mi chiede se voglio salvare o aprire il file, non mi segnala
la dimensione del file.
E' come se legesse 0 KB.
Con un file più piccolo (3,77 Mega) funziona tutto, anche se poi, aprendolo e scorrendo le varie pagine, mi dà un errore di disegno.
Grazie
A
aviscome
@aviscome
Post
-
Problema con il download di un file pdf -
Problema con il download di un file pdfLo script che utilizzo è il seguente:
<?php $file_name = "2005.pdf"; # file name, UTF-8 encoded $file_mime = "application/pdf"; # MIME type $file_path = "portaldata/UserFiles/File/2005.pdf"; header("Content-Type: octet-stream"); header("Content-Length: " . filesize($file_path)); $agent = $_SERVER["HTTP_USER_AGENT"]; if( is_int(strpos($agent, "MSIE")) ){ # Remove reserved chars: :\/*?"<>| $fn = preg_replace('/[:\\x5c\\/*?"<>|]/', '_', $file_name); # Non-standard URL encoding: header("Content-Disposition: attachment; filename=" . rawurlencode($fn)); } else if( is_int(strpos($agent, "Gecko")) ){ # RFC 2231: header("Content-Disposition: attachment; filename*=UTF-8''" . rawurlencode($file_name)); } else if( is_int(strpos($agent, "Opera")) ) { # Remove reserved chars: :\/*{? $fn = preg_replace('/[:\\x5c\\/{?]/', '_', $file_name); # RFC 2231: header("Content-Disposition: attachment; filename*=UTF-8''" . rawurlencode($fn)); } else { # RFC 2616 ASCII-only encoding: $fn = mb_convert_encoding($file_name, "US-ASCII", "UTF-8"); $fn = (string) str_replace("\\", "\\\\", $fn); $fn = (string) str_replace("\"", "\\\"", $fn); header("Content-Disposition: attachment; filename=\"$fn\""); } readfile($file_path); ?>Il problema che il file pdf (creto con INdesign) è di 22 Mega
e sembra non riesco a fare il download di file superiori a 3 Mega. -
Problema con il download di un file pdfSalve,
sono nuovo e non so bene come funziona.
Ho un problema con il download di un file pdf
con uno script in PHP, e mi serviva un aiuto.
Sono nel posto giusto....