Wednesday, 15 July 2015

php - computer get suspended after clicking download button -



php - computer get suspended after clicking download button -

i create php code download function. work when downloading jpg file when utilize mp3 file computer suspended. here codes:

this form download. <form action="test.php" method='post'> download music1: <input type="submit" value="download"> </form>

this download function.

<?php $filename = 'sloth.jpg'; // name of file downloaded $filepath = "c:\\xampp\\htdocs\\test\\sloth\\"; // folder of file downloaded , can set file in folder on server more order $size = filesize($filepath . $filename) ; header("content-type: application/force-download; name=\"". $filename ."\""); header("content-transfer-encoding: binary"); header("content-length: ". $size .""); header("content-disposition: attachment; filename=\"". $filename ."\""); header("expires: 0"); header("cache-control: no-cache, must-revalidate"); header("pragma: no-cache"); echo (readfile($filepath . $filename)); ?>

if utilize mp3 file computer suspend after cliking download button.

php download

No comments:

Post a Comment