PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Why don't you turn on error reporting and get rid of the @ in the unlink() so you can actually get the error?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Warning: unlink(uploads/thumbs/) [function.unlink]: Is a directory in
any ideas?
Thanks in advance,
Batoe
Yes, $url is empty.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
What I'm saying is that, I can see in your code that: $tdir = "uploads/thumbs/" and you are trying to unlink($tdir . $url) and the error is that uploads/thumbs is a directory and can't be deleted, so that means that the variable $url doesn't contain anything.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Ok, I see what you are saying. The variable $url contains the file name but not the path and since the image file is in a different directory, unlink cannot locate the image file! So how do I get $url to include the directory path?
I tried connecting it with $tdir :
AbraCadaver wrote:What I'm saying is that, I can see in your code that: $tdir = "uploads/thumbs/" and you are trying to unlink($tdir . $url) and the error is that uploads/thumbs is a directory and can't be deleted, so that means that the variable $url doesn't contain anything.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Just do what I posted. Don't put it in the unlink(). The point is that $url is empty, there is no value in it. The reason is that there is no $_GET['url'].
Also, put this at the top of all of your files while you are developing:
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
ok, I think I steered you into the wrong direction. The $_GET['url'] is present, but it is at the top of the script.
I know it works because the delete.php page shows the image that will be deleted via $url. Sorry for the misunderstanding. here is the whole script that shows the image and the delete button:
You still haven't given me the output of the echo, and you still haven't posted ALL the errors you get when you add the error reporting code.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.