Jump to content

ftp_rename()


scott_allen13

Recommended Posts

I have a script that i didn't write that uploads a photo and then resizes it and renames it. it uses ftp_rename() which looks fairly straight forward. but for some reason, it's not working.

 

// set up basic connection
		$conn_id=0;
		$conn_id = ftp_connect($ftp_server, $port); 

		// login with username and password
		@ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
		@ftp_chdir($conn_id, '/pictures/');

		// rename the file
		$ImagePath = "zXy".$ImageNum.".".$ImageType;
		$newName = "dog".$DogID.".".$ImageType;
		if(@ftp_rename($conn_id, $ImagePath, $newName)) {
			echo "successful rename.";
		} else {
			echo " broken";
		}
		@ftp_close($conn_id);

 

that doesn't seem difficult to read and looks right to me. but it always echos "broken". i've traced thru all the variables, and it says it is changing the right file to the correct new name, but it just doesn't do it. also, the ftp connection is definitely being made. any other ideas?

Link to comment
https://forums.phpfreaks.com/topic/41508-ftp_rename/
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.