banner

Sabuj Kundu 27th Nov 2016

If you try the wordpress import plugin or import option from tools menu to import content/data xml file you may get error message like below in some server environment/scopes.

Remote file is incorrect size

So, what happens actually ? when you first time try to import wordpress ask to intall the importer plugin “wordpress-importer”, if you go to plugin dir you will see a folder for such name. Then it’s ask to run the import, you browse the xml file that you exported from somewhere else(another wordpress site) and click import you may experience that no attachment is downloaded or it showing error message "Remote file is incorrect size". Sometimes, it may cause due to network error or incomplete download of file, but most cases this happens that remote file is downloaded as gzip and the actual file size and header response "content-length" is not same technically but the file is downloaded correctly. What wordpress does is it deletes the downloaded file !

Here is the fix

Go to wordpress plugin dir, open plugin folder “wordpress-importer” , open php file “wordpress-importer.php” and search text “Remote file is incorrect size”

Now comment lines from 1007-1011 or find the lines checking the below code.

https://gist.github.com/manchumahara/cf6577040a2e7582dc36c1133000d10c

Now try to import and check if the attachments are downloading properly.

Happy coding.