Jump to content

Having some Issues Renaming Some Images


cooldude832

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/51759-having-some-issues-renaming-some-images/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.