cooldude832 Posted May 17, 2007 Share Posted May 17, 2007 I have a submitter program that puts ads into a database, I temporarily put the images in a location so that if they are changed the temp names stay the same. Any ways after the users is done editing the ad I have a page that pushes the data to a mysql table and then attempts to rename the images to a permeate location. However I get: Warning: rename(files/61893_1.jpg,horse_41_1.jpg): Permission denied in /hsphere/local/home/pira00/upperstraitscleanlake.org/horse/horse_sql.php on line 85 The file that has the code is in the subfolder horses the images are in horses/files/ and i want to rename them to /horses/files/horse_num_num.jpg This is my code: $i=1; //Lets move those images into a folder so they don't get lost in temps while ($i <=4) { $newimgpath .= "horse_"; $newimgpath .= $idnum; $newimgpath .= "_"; $newimgpath .= $i; $newimgpath .= ".jpg"; $set = "-rw-rw-rw-"; chmod("/".$path[$i], 0777); rename("/".$path[$i],$newimgpath); $i++; } the array $path is valid Quote Link to comment https://forums.phpfreaks.com/topic/51759-having-some-issues-renaming-some-images/ Share on other sites More sharing options...
hitman6003 Posted May 17, 2007 Share Posted May 17, 2007 check the permissions of the folder you are moving the files to...if you are using *nix do "chmod 0755 foldername". If windows, turn on "modify" permissions for the web username. Quote Link to comment https://forums.phpfreaks.com/topic/51759-having-some-issues-renaming-some-images/#findComment-254972 Share on other sites More sharing options...
cooldude832 Posted May 17, 2007 Author Share Posted May 17, 2007 is there a way to set chmod for the folder with php? Quote Link to comment https://forums.phpfreaks.com/topic/51759-having-some-issues-renaming-some-images/#findComment-254975 Share on other sites More sharing options...
MadTechie Posted May 17, 2007 Share Posted May 17, 2007 try chmod Quote Link to comment https://forums.phpfreaks.com/topic/51759-having-some-issues-renaming-some-images/#findComment-254979 Share on other sites More sharing options...
cooldude832 Posted May 17, 2007 Author Share Posted May 17, 2007 would it be: $dir = "/files/"; chmod($dir], 0777); ?? Quote Link to comment https://forums.phpfreaks.com/topic/51759-having-some-issues-renaming-some-images/#findComment-254980 Share on other sites More sharing options...
MadTechie Posted May 17, 2007 Share Posted May 17, 2007 as a note try using the absolute path, relative has cause me problems on sime servers Quote Link to comment https://forums.phpfreaks.com/topic/51759-having-some-issues-renaming-some-images/#findComment-254984 Share on other sites More sharing options...
cooldude832 Posted May 17, 2007 Author Share Posted May 17, 2007 absolute all the way back like http://www.domain.com/subfolder or absolute as in /hpshere/etcetc/etc/ Quote Link to comment https://forums.phpfreaks.com/topic/51759-having-some-issues-renaming-some-images/#findComment-254988 Share on other sites More sharing options...
cooldude832 Posted May 17, 2007 Author Share Posted May 17, 2007 I got it working now, but my whole directory "root" in this case is 0,777 and everything below it is there a way to set the dir to 0777 pre image adjustments and then back to lockdown after? Quote Link to comment https://forums.phpfreaks.com/topic/51759-having-some-issues-renaming-some-images/#findComment-254990 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.