Welcome Guest, Not a member yet? Register   Sign In
Rename function not working
#1

[eluser]reyntjensw[/eluser]
I'm trying to rename a file that's in my images folder. So I'm using rename
Code:
rename(realpath("../images/sky2.jpg"),realpath("../images/sky3.jpg"));

The file exists in my folder and has all permissions, (I did a chmod 777).
I'm also able to upload images in that folder so the folder (I think) isn't the problem.

Anyone with ideas?

Thanks
#2

[eluser]bretticus[/eluser]
Off the top of my head, I would echo out the result of realpath("../images/sky2.jpg") and make sure it was a valid path. Otherwise, hard to say. Well, you do need to make the container folder have write permissions too. I suggest NOT using 777. Find out which user the web server runs as (often your user in many hosting solutions) and then make sure that user has write permissions for the container folder (images.)
#3

[eluser]reyntjensw[/eluser]
Bretticus,

I found the mistake, the path wasn't correct, it had to be images/...
Thanks for your tips and help.




Theme © iAndrew 2016 - Forum software by © MyBB