my script file path is:


I need to run code from this path that will move images from path:




My problem is that I have no idea how to force “rename” go two directories back in path.

I was trying something like:

$srcPath = realpath(dirname(__FILE__) . '/../..' . '/uploads/2017/04/obrazek.png');

error I’m getting atm (I’ve changed my folder permissions, so maybe it is something with path?):

Warning: rename(C:xampphtdocswordpresswp-contentuploads20174obrazek.png,C:xampphtdocswordpresswp-contentuploadsimages): access denied
. (code: 5) in C:xampphtdocswordpresswp-contentpluginsuploadsdir-managertest.php on line 16

Read more here: php rename (move) from one dir to another that is two levels back


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: