note 98651 modified in function.readfile by danbrown

From: Date: Tue, 30 Nov 2010 15:19:32 +0000
Subject: note 98651 modified in function.readfile by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-174483@lists.php.net to get a copy of this message
I was getting errors playing music files when downloading, using the Content-Length header as listed in the examples above. I plugged in the numeric size of the file in bytes, removing the filesize command and it worked. At a loss for other ideas, I had the filesize command populate a variable, then I added one to the variable when calling it for the filesize. It worked like a champ, but... My files are still cutting off, and I think it has something to do with my server. Back to the drawing board, I guess. Here's the snippet for reference: <?php $filesize = filesize($dir_name); header('Content-Length: '.$filesize+1); ?> Hopefully this will help someone more than it helped me. Cheers. --was-- I was getting errors playing music files when downloading, using the Content-Length header as listed in the examples above. I plugged in the numeric size of the file in bytes, removing the filesize command and it worked. At a loss for other ideas, I had the filesize command populate a variable, then I added one to the variable when calling it for the filesize. It worked like a champ, but... My files are still cutting off, and I think it has something to do with my server. Back to the drawing board, I guess. Here's the snippet for reference: $filesize = filesize($dir_name); header('Content-Length: '.$filesize+1); Hopefully this will help someone more than it helped me. Cheers. http://php.net/manual/en/function.readfile.php

« previous php.notes (#174483) next »