Title: Warning: filesize() [function.filesize]: stat failed
Last modified: August 21, 2016

---

# Warning: filesize() [function.filesize]: stat failed

 *  Resolved [PsychicSmurf](https://wordpress.org/support/users/psychicsmurf/)
 * (@psychicsmurf)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/warning-filesize-functionfilesize-stat-failed/)
 * When I have an attachment in a post, and have display filesize enabled, I’m getting:
 * `Warning: filesize() [function.filesize]: stat failed for /home/crystali/public_html/
   agnosticpagan/wp-content/uploadsn.co.uk/wp-content/uploads/2013/06/example.txt
   in /home/crystali/public_html/agnosticpagan/wp-content/plugins/mimetypes-link-
   icons/mime_type_link_images.php on line 1310`
 * It would seem that the path to the file is getting corrupted (which then makes
   the function fail):
    `/home/crystali/public_html/agnosticpagan/wp-content/uploadsn.
   co.uk/wp-content/uploads/2013/06/example.txt` should be `/home/crystali/public_html/
   agnosticpagan/wp-content/uploads/2013/06/example.txt`
 * Somehow an extra `"n.co.uk/wp-content/uploads"` is getting injected into the 
   path. Any ideas?
 * It happens on either my full post page:
    [http://agnosticpagan.co.uk/](http://agnosticpagan.co.uk/)
   or the summary page: [http://agnosticpagan.co.uk/?page_id=38](http://agnosticpagan.co.uk/?page_id=38)
 * [http://wordpress.org/extend/plugins/mimetypes-link-icons/](http://wordpress.org/extend/plugins/mimetypes-link-icons/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Contributor [Juliette Reinders Folmer](https://wordpress.org/support/users/jrf/)
 * (@jrf)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/warning-filesize-functionfilesize-stat-failed/#post-3847720)
 * Hiya,
 * Thanks for reporting this! I’m going to try and fix this, but need some more 
   info to determine the cause.
 * As you have debugging set to true, could you have a look at the bottom of the
   settings page ? If should have an array with the settings listed.
    Could you 
   check what the value is for “internal_domains” ?
 * Also, if you’d be willing to do so, could you temporarily add the following code
   on line 1290 (empty line just above ‘try and get the filesize’ comment) of the
   plugins/mimetypes-link-icons/mime_type_link_images.php file and let me know what
   the output is ?
 *     ```
       if( WP_DEBUG === true ) {
       	print '<pre>';
       	print_r( array(
       		'home_path'	=>	$home_path, 'site_path'	=>	$site_path, 'wp_upload'	=>	$wp_upload, 'path_to_home'	=>	$path_to_home, 'site_root'	=>	$site_root, 'path_to_upload'	=>	$path_to_upload, 'test1'		=>	in_array( substr( $url, 0, 1 ), array( '/', '\\', '.' ) ), 'test2'		=>	$this->is_own_domain( $url ), 'rel_url'	=>	(isset( $rel_url ) ? $rel_url : 'not set'),
       	) );
       	print '</pre>';
       }
       ```
   
 * Thanks,
    Juliette
 *  Thread Starter [PsychicSmurf](https://wordpress.org/support/users/psychicsmurf/)
 * (@psychicsmurf)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/warning-filesize-functionfilesize-stat-failed/#post-3847731)
 * I haven’t enabled WP_DEBUG, and haven’t explicitly changed anything to enable
   debugging. It’s possible that my php.ini files may have debug out enabled though
   for my development.
 * However, I’ve now just enabled it so we can debug, and the setting page shows:
 *     ```
       [internal_domains] => Array
               (
                   [0] => agnosticpaga
               )
       ```
   
 * I then added in the temporary code @ line 1290 and it shows:
 *     ```
       Array
       (
           [home_path] => /home/crystali/public_html/agnosticpagan/
           [site_path] => /home/crystali/public_html/agnosticpagan/
           [wp_upload] => Array
               (
                   [path] => /home/crystali/public_html/agnosticpagan/wp-content/uploads/2013/06
                   [url] => http://agnosticpagan.co.uk/wp-content/uploads/2013/06
                   [subdir] => /2013/06
                   [basedir] => /home/crystali/public_html/agnosticpagan/wp-content/uploads
                   [baseurl] => http://agnosticpagan.co.uk/wp-content/uploads
                   [error] =>
               )
   
           [path_to_home] =>
           [site_root] =>
           [path_to_upload] => /wp-content/uploads
           [test1] =>
           [test2] => n.co.uk/wp-content/uploads/2013/06/example.txt
           [rel_url] => n.co.uk/wp-content/uploads/2013/06/example.txt
       )
       ```
   
 *  Thread Starter [PsychicSmurf](https://wordpress.org/support/users/psychicsmurf/)
 * (@psychicsmurf)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/warning-filesize-functionfilesize-stat-failed/#post-3847739)
 * It may be pertinent, but I tried to download the plugin using the above link,
   and also through the WP interface, and both gave me 404 File not found.
 * I managed to download the plugin using:
 * [http://downloads.wordpress.org/plugin/mimetypes-link-icons.zip](http://downloads.wordpress.org/plugin/mimetypes-link-icons.zip)
 * It appears to be the same as the SVN, but thought it may be important to mention.
 *  Plugin Contributor [Juliette Reinders Folmer](https://wordpress.org/support/users/jrf/)
 * (@jrf)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/warning-filesize-functionfilesize-stat-failed/#post-3847748)
 * I just noticed the same (404), will check in with Toby about that.
 * In the mean time, could you try the following:
 * In file `mimetypes-link-icons/mime_type_link_images.php`, replace line 1310:
 *     ```
       return filesize( $this->sync_dir_sep( $wp_upload['basedir'] ) . $rel_url );
       ```
   
 * with:
 *     ```
       return filesize( $this->sync_dir_sep( $wp_upload['basedir'] ) . substr( $rel_url, ( stripos( $rel_url, $path_to_upload ) + strlen( $path_to_upload ) ) ) ) );
       ```
   
 * From your debug values I can see something is going wrong with the internal domain
   value, will look into that as well, but I kind of hope that the above change 
   will fix the error for now.
 * Let me know how you get on! Thanks.
 *  Thread Starter [PsychicSmurf](https://wordpress.org/support/users/psychicsmurf/)
 * (@psychicsmurf)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/warning-filesize-functionfilesize-stat-failed/#post-3847758)
 * Yes, that has fixed the issue my end! Many thanks.
 * I’ll tag this as resolved and leave the other investigations to you 🙂
 * Many thanks for a swift fix, and a very useful plugin!
 *  Plugin Contributor [Juliette Reinders Folmer](https://wordpress.org/support/users/jrf/)
 * (@jrf)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/warning-filesize-functionfilesize-stat-failed/#post-3847763)
 * Excellent! Glad to hear that solved the issue and I’ll make sure the fix makes
   it into the next version.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Warning: filesize() [function.filesize]: stat failed’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/mimetypes-link-icons.svg)
 * [MimeTypes Link Icons](https://wordpress.org/plugins/mimetypes-link-icons/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mimetypes-link-icons/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mimetypes-link-icons/)
 * [Active Topics](https://wordpress.org/support/plugin/mimetypes-link-icons/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mimetypes-link-icons/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mimetypes-link-icons/reviews/)

## Tags

 * [filesize](https://wordpress.org/support/topic-tag/filesize/)
 * [path](https://wordpress.org/support/topic-tag/path/)

 * 6 replies
 * 2 participants
 * Last reply from: [Juliette Reinders Folmer](https://wordpress.org/support/users/jrf/)
 * Last activity: [12 years, 12 months ago](https://wordpress.org/support/topic/warning-filesize-functionfilesize-stat-failed/#post-3847763)
 * Status: resolved