php rename (move) from one dir to another that is two levels back

my script file path is:

C:xampphtdocswordpresswp-contentpluginstesttest.php

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

C:xampphtdocswordpresswp-contentuploads20174

to:

C:xampphtdocswordpresswp-contentuploadsimages

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

Leave a Reply

Your email address will not be published. Required fields are marked *