Hello, I have created this code below, but though it works, it spits out a rather annoying error message.
It works, but the fact is it just gives out an error message and it's annoying.
It says "Permission denied" but it works.How?
<?php array_map('unlink', glob("uploader/uploads/".$file_name."".$file_extension."")); ?>
(The variables are defined earlier in the document, and it does delete the file I want, but it just randomly gives that error.)
Delete a File
Moderator: General Moderators
Re: Delete a File
What are the values of $file_name and $file_extension? What files does glob() find? Are any of them also directories? Are you sure it actually did delete every file you expected it to?
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Delete a File
I don't know about the error, but why use glob? It looks like you are only deleteing one file unless one of the vars contains something like .*
Code: Select all
unlink("uploader/uploads/".$file_name.$file_extension);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.