Failed to import Media: Remote file is incorrect size *BYPASS*
-
This has taken me about two weeks to resolve but I think I finally found out why this is happening!
In the file wordpress-importer.php, when the call to HTTP GET via wp_get_http() is issued to retrieve the image from the source server, the request header allows for compressed results to be returned. If this case the “Content-Length” response header will be present and will be the size of the compressed file, not the uncompressed size, which is what the plugin checks against. 90% of the time this check will fail.
Either the HTTP GET request should be issued without the “Accept-Encoding” header or a check for a “Content-Encoding” response header being present should be made and subsequently bypass the filesize check.
What I can’t figure out is how to pass this onto the development team so perhaps someone in the know that is reading this can do that for us!
PS: For this who want a quick-and-dirty fix, edit
/wp-content/plugins/wordpress-importer/wordpress-importer.php
to enclose the lines below inside PHP comments /* and */. In my case, these are lines 921-925 (yours may vary). Once I made this change, absolutely everything came across just fine! Before that … just ugly!if ( isset( $headers['content-length'] ) && $filesize != $headers['content-length'] ) { @unlink( $upload['file'] ); return new WP_Error( 'import_file_error', __('Remote file is incorrect size', 'wordpress-importer') ); }
After updating, these lines should look like…
/* if ( isset( $headers['content-length'] ) && $filesize != $headers['content-length'] ) { @unlink( $upload['file'] ); return new WP_Error( 'import_file_error', __('Remote file is incorrect size', 'wordpress-importer') ); } */
Be sure to upload the file back to your server.!
- The topic ‘Failed to import Media: Remote file is incorrect size *BYPASS*’ is closed to new replies.