Created
April 20, 2014 10:12
-
-
Save rleger/11110416 to your computer and use it in GitHub Desktop.
PHP Delete File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Deleting file | |
* @param string $fullpath Filename with its full path | |
* @return array key => result | |
*/ | |
function deleteFile( $fullpath ) { | |
if (file_exists($fullpath)) { | |
$hasBeenDeleted = unlink($fullpath); | |
if ($hasBeenDeleted) { | |
$result = array( | |
"result" => 1, | |
"message" => "File has successfully been deleted !" | |
); | |
} | |
} else { | |
$result = array( | |
"result" => 0, | |
"message" => "File was not found !" | |
); | |
} | |
return $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment