I am in the middle of building an image forum type thing, at the stage now users can upload photos and so on, people can rate, all works very nicely. However when users want to delete their photos i can delete all records of them from teh Database but for some reason am having problems deleting the phyical file from teh server

so currently i have
All details for server FTP are 100% correct i is sure, and the var $file is passed from an SQL statment.

if (file_exists($file)) {
mysql_query($queryDeletePhotos ,$db);
mysql_query($queryDeleteRatings ,$db);

$conn_id = ftp_connect($ftp_server);

$login_result = ftp_login($conn_id, $ftpuser, $ftppass);

if (ftp_delete($conn_id, $file)) {
echo "$file deleted successful\n";
} else {
echo "could not delete $file\n";


So basicly if the file exists on teh server run the statment SIMPLE however no its not. The file does exist and the code runs but gives me the error

Warning: ftp_delete(): UsImages/4_81.jpg: No such file or directory in /public_html/PHPproDeleteimg.php on line 48
could not delete UsImages/4_81.jpg

i have hard coded in the path to the file no change same error, i just dont understand, PHP can see the file and already checks that it exists but can not see it when it wants to delete it.

Anyhelp would be great, plan to work on it tomorrow so will update if i figure it out myself.

thanks in advance