Setting up PHP renaming could be best. I have not seen many examples of how to use relative URLs in it, so I'm kind of compromised. Anyway, this gives me permission:
I want to do this:
$file = "../data.csv"; rename("$file", "../history/newname.csv");
Where ../ , of course, will return 1 directory from which the script is executed. I could not figure out a way ... so I did this instead:
$file = "data.csv"; $path = dirname(realpath("../".$file)); rename("$path/$file", "$path/history/newname.csv");
However, I get permission (yes, the history folder belongs to www-data, and data.csv belongs to www-data). I thought it was weird, so I tried a simple test:
rename( 'tempfile.txt', 'tempfile2.txt' );
and I made sure www-data has full control over tempfile.txt ... still got permission. What for? should the file you rename exist? can you rename like linux mv? So instead I just copy () and unlink ()?
Parox source share