Question Detail

how to upload image in wordpress on localhost?

4 years ago Views 1102 Visit Post Reply

Warning: move_uploaded_file(http://localhost/wordpress/wp-content/plugins/coinmen_capital/images/CAPITAL1.jpg): failed to open stream: HTTP wrapper does not support writeable connections in C:\xampp\htdocs\wordpress\wp-content\plugins\coinmen_capital\index.php 

Thread Reply

Manish Kumar

- 4 years ago

IMPORTANT thing: this code is working on Localhost not working on Live. 

You can use this:

$_SERVER['DOCUMENT_ROOT'] gives path to htdocs (like. C:/xampp/htdocs)

move_uploaded_file($file_tmp, $_SERVER['DOCUMENT_ROOT']."/wordpress/wp-content/plugins/coinmen_capital/images/".$file_name)