explode!
| From: | Bacon Luvva | Date: | Sat, 17 Mar 2001 20:37:45 +0000 |
| Subject: | explode! | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-6115@lists.php.net to get a copy of this message | ||
I have a news database. One of the fields in the database is a field
that describes the path to an image on the server. ie:
../images/imagefile.gif
I have a script that deletes news stories from the database and this is
where I am stuck.
Everything works okay when deleting the story but when it comes to the
deletion of the image file... no go.
I have used the unlink function
if ( ! ($delimage=unlink($imagefield)))
{
DisplayErrMsg(sprint("internal error %d:%s\n",
mysql_errno(), mysql_error()));
exit();
}
The function fails with:
Warning: Unlink failed (No such file or directory) in
c:\Inetpub\wwwroot/news/admin/delete_news.php on line 24
internal error 0:
I know that the info in the database is a URL (../images/imagefile.gif)
and not an actual path.
Is there a way to strip the url back to the image name and replace it
with the path so the file can be removed?.
I have explored the possibilities of the explode function and believe
this is the function I need to use? (so far without much success!)
Thus I have come to you fine folk for some help on how I might do this.
Grateful for any pointers on this one,
Regards,
Karl.