0

I am trying to upload a PHP file to WordPress root folder (www or public_html).

How can I do it ?

I want to implement it on my theme. I tried with move_uploaded_file , but it's not uploading anywhere.

user3382203
  • 169
  • 1
  • 6
  • 25

2 Answers2

0

Please add the below code after require_once(ABSPATH.'wp-settings.php'); declaration.

define('UPLOADS', 'files');

Please note that, you have to use the default wordpress media manager instead of your own custom code with "move_uploaded_file".

Please refer, http://www.hongkiat.com/blog/wordpress-custom-upload-dir/

manian
  • 1,418
  • 2
  • 16
  • 32
-1

Just use ftp, that's the only easiest way to upload files to your root directory with wordpress. I guess your using webhosting for your wordpress website, login on their website and check for ftp credentials or just ask them for it. Most of the time i use filezilla for uploading files to wordpress. Filezilla

Arnout Pullen
  • 185
  • 2
  • 13
  • i am asking can i do via theme coding ? why normal php upload script not working with wordpress ? i can do with FTP too , but this time i have to upload file wordpress root .. but i only have WPadmin account .. – Kaleel Rahman May 30 '17 at 07:26