I'm writing a PHP page that generates a podcast feed by scraping an existing HTML page. Everything works great, but one of my mp3 files gives a "filesize(): stat failed" error. As best as I can tell, the file isn't corrupted, and it plays perfectly fine. I've also reuploaded the file to the server. It falls in the middle range of all the file sizes, so I don't think the file is too large. Because every other file returns a file size, I'm assuming the problem is with the mp3 file, not with my server configuration. Is there something else I should be checking?
Here's the relevant part of my code:
$i = 1; //skipping header row on table
do {
$tr = $table->find('tr', $i);
$date = $tr->find('div', 0)->plaintext;
$datetime = new DateTime($date);
$speaker = $tr->find('div', 1)->plaintext;
$title = $tr->find('div', 2)->plaintext;
$url = $tr->find('div', 3)->find('a', 0)->href;
$fullurl = "http://domain.org/resources/".$url;
$filesize = filesize($url); //<---works on every file except one
echo "<item><title>".$title."</title>\n";
echo "<description>".$title." - ".$datetime->format('D, M jS, Y')." - ".$speaker."</description>\n";
echo "<itunes:author>".$speaker."</itunes:author>\n";
echo "<enclosure url=\"".$fullurl."\" length=\"".$filesize."\" type=\"audio/mpeg\"/>\n";
echo "<guid isPermaLink=\"true\">".$fullurl."</guid>\n";
echo "<pubDate>".$datetime->format('r')."</pubDate>\n";
echo "<itunes:explicit>clean</itunes:explicit></item>\n\n";
$i++;
}while ($table->find('tr', $i) != NULL);
As requested: (do people point out edits? This is my first question here..)
The filename is "12-20-09_AM_Podcast.mp3" which follows the naming convention of every other file, and all the files have permissions of 644. The full error code is
<b>Warning</b>: filesize() [<a href='function.filesize'>function.filesize</a>]: stat failed for audio/12-20-09_AM_Podcast.mp3 in <b>/homepages/1/d106955786/htdocs/victory/resources/podcast1.php</b> on line <b>45</b><br />