WordPress is importing xml file as txt and adding it to media

In my WordPress install when I try to run the importer to import an xml file, the .txt extension is being added to the end and the file ends up in the media library. I receive this error ‘The export file could not be found at /var/www/html/wp-content/uploads/2020/07/****.xml_.txt. It is likely that this was caused by a permissions problem.’ I’m stuck with this and haven’t been able to find anything related to the issue.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @stu1106,

With the plugin are you getting the same issue?

One other thing, can you try and install PHP 7.4 with the following commands:

sudo apt-get update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt -y install php7.4
sudo apt-get install -y php7.4-{bcmath,bz2,intl,gd,mbstring,mysql,zip}

You’ll need to add a few more extensions to your php7.4 - dom, gmagick, SimpleXML, ssh2, XML, xmlreader, curl, date, exit, filter , ftp, gd, hash, iconv, imagick, json, libxml, mbstring, mysqli, openssl, pcre, posix, sockets, SPL, tokenizer, zlib, pdo.

All of the extensions should be installed like so

apt-get install -y php7.4-iconv

Regards, KFSys

Hi @stu1106,

In most cases you have a PHP extension missing that’s preventing it from working properly. In your case, You’ll need to install the PHP DomDocument extension. This extension is actually contained in XML.

Do you know if you are using Ubuntu or Apache? If it’s Ubuntu, you can use the following command

sudo apt-get install php-xml

If you are using CentOS

yum install php-xml

Regards, KFSys