I am getting the following error when trying to echo the HTML contents of a file inside a wordpress plugin folder.
Warning: filesize() [function.filesize]: stat failed for http://bestideabox.com/wp-content/plugins/jww-namechord/ includes/template-files/single-form.html in /home/bestidea/public_html/wp-content/plugins/ jww-namechord/includes/core.php on line 44
Here is the function that reads the file:
return jww_display_file(
plugins_url( 'template-files/'.$template.'.html',__FILE__ )
);
function jww_display_file( $fileToRead ){
//Open the file and read it
$handle = fopen( $fileToRead, "r" );
$contents = fread( $handle, filesize( $fileToRead ) );
fclose( $handle );
//return it
return $contents;
}
I am at a complete loss. Any Help would be appreciated.
Not sure how to mark this as an answer, but thanks to DaveRandom I have a solution:
The http:// wrapper does not support stat(). You cannot filesize() a HTTP URL. You can use the Content-Length: header of the response if the server returns one, but you actually don't need to here. Just replace the entire body of that function with return file_get_contents($fileToRead); and you're set. – DaveRandom
To those who marked as duplicate. You can see from answer it is not the same issue. Thanks guys for all your help!
Baby Naming 101 - No "Y" support