scott_allen13 Posted March 6, 2007 Share Posted March 6, 2007 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 More sharing options...
trq Posted March 6, 2007 Share Posted March 6, 2007 Remove the @ from the begining of the call to ftp_rename. This should enable errors which may give you a better idea of the problem. Link to comment https://forums.phpfreaks.com/topic/41508-ftp_rename/#findComment-201090 Share on other sites More sharing options...
scott_allen13 Posted March 6, 2007 Author Share Posted March 6, 2007 sorry, i've removed it... i'm not getting any errors. it just fails the if, runs the else and keeps moving. Link to comment https://forums.phpfreaks.com/topic/41508-ftp_rename/#findComment-201101 Share on other sites More sharing options...
trq Posted March 6, 2007 Share Posted March 6, 2007 Then you need to enable errors. Put this at the top of your script. <?php error_reporting(E_ALL) ; ini_set('display_errors','1'); ?> Link to comment https://forums.phpfreaks.com/topic/41508-ftp_rename/#findComment-201107 Share on other sites More sharing options...
scott_allen13 Posted March 6, 2007 Author Share Posted March 6, 2007 the problem must have been elsewhere. it's working now. does ftp_rename have issue with being in a folder, rather than the root of the server? either way... thanks for trying to help. scott Link to comment https://forums.phpfreaks.com/topic/41508-ftp_rename/#findComment-201232 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.