How can we upload file to root directory of wordpress

I'm working on wordpress project, Theme have some demos i've added add_menu_page where all of the demos stored e.g pictures and names, I know the REST-API where i've added condition if theme license is correct then give file, But i don't know how to add that file in theme directory of wordpress when user will click and remove previous one or overwrite previous file.

Topic theme-customizer plugin-development Wordpress

Category Web


Hopefully you have access to your server (i.e. you don't use a wordpress.com website but have your own server).

You'll have to connect to the server with either SFTP or SSH (via the use of scp to copy files) or another similar protocol and upload the files to wherever you want. In order to use these, you generally have a special URL and you'll need a login/password (SFTP) or a security key (SSH). At times, the services offer you a system such as phpMyAdmin. That should also give you access to your server file system and you can upload files through that system.

The PHP code from Wordpress will not allow you to just go in and update just any file or directory for obvious security reasons (already the plugins are editable...)

If you do not own the server, depending on your provider, you may be able to ask them to do it for you. There may be extra charges or just plain refusal, again, for security reasons (especially if that provider runs many Wordpress websites, it could jeopardize the other sites).

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.