27. februar 2003 - 22:07
Der er
8 kommentarer og 1 løsning
Headers?
Hei... Jeg har et problem! Har den her kode: <html> <head> <title>[ Opvarmning! ]</title> </head> <body> <? if($downFile) { header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); header("Content-Disposition: attachment; filename=".$downFile); header("Content-Type: application/doc"); header("Content-Length:".filesize($downFile)); readfile($downFile); } ?> <a href="index.php?downFile=opv.doc">Download min fil</a> </body> </html> Den kan ikke downloade filen automatisk! Den melder fejl hele tiden... Nogen der kan hjælpe? /dhunters
Annonceindlæg fra Kingston Technology
27. februar 2003 - 22:12
#1
dine header skal før dit html: <? if($downFile) { header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); header("Content-Disposition: attachment; filename=".$downFile); header("Content-Type: application/doc"); header("Content-Length:".filesize($downFile)); readfile($downFile); } ?> <html> <head> <title>[ Opvarmning! ]</title> </head> <body> <a href="index.php?downFile=opv.doc">Download min fil</a> </body> </html>
27. februar 2003 - 22:13
#2
Formentlig skal du faktisk <? if($downFile) { header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); header("Content-Disposition: attachment; filename=".$downFile); header("Content-Type: application/doc"); header("Content-Length:".filesize($downFile)); readfile($downFile); exit(); } ?> <html> <head> <title>[ Opvarmning! ]</title> </head> <body> <a href="index.php?downFile=opv.doc">Download min fil</a> </body> </html>