I have a filestructure that looks like this:
Folder_1
Folder_2
phpfile1.php
Folder_3
Folder_4
random_pic.jpg
Folder_5.
What should be the src and dest paths if I wanna copy/move randompic.jpg from Folder 4 to Folder 5?
I've tried:
I thought this is how absolute path would look.
copy("/var/a/b/c/Folder_3/Folder_4/random_pic.jpg", "/var/a/b/c/Folder_3/Folder_5/random_pic.jpg") ;
relative to the last place it was, src relative to where the script is and dest relative to src.
copy("../Folder_3/Folder_4/random_pic.jpg", "../Folder_5/random_pic.jpg");
both src and dest paths relative to where php script is.
copy("../Folder_3/Folder_4/random_pic.jpg", "../Folder_3/Folder_5/random_pic.jpg");
All 3 returned PHP Warning ... Failed to open stream ... no such file or directory in ...
You should always only use absolute paths. You can read about why and how here : PHP - Failed to open stream : No such file or directory