I've been trying to move a file from one folder on a web server to another using copy.
If I use chdir() on the folder the image file is in before calling the function I can sucessfully copy the file within the same folder but with a different name:
Code: Select all
chdir("images");
//from the webroot this folder is contribute/static/images/
copy("image.jpg", "newimage.jpg");Code: Select all
chdir("images");
copy("image.jpg", "../newimage.jpg");So then I tried "../../../assets/images/newimage.jpg" which is the three levels up out of one folder to the root and back down two levels into the other. I've tried many combinations but I either get "no such file or directory" or "basedir restriction in effect...."
The example in the manual only copies and renames a file into the same directory as the source so I got no help here. Can I chdir() mid function to send the file to the correct destination?