below is my code.. bt cant delete the file, help please...y cant it delete?
function deleteFile($id_file) {
$infoFile = $this->getFileInfo($id_file);
$folderPath = $this->folderPath($infoFile["id_folder"]);
if (substr($infoFile["file_name"], 0, 3) == ".ht") {
$this->error = 6;
return false;
}
if (!file_exists($this->root . "files" . $folderPath . SEP . $infoFile["file_name"])) {
$q = "UPDATE " . TABLE_PREFIX . "files SET file_flag = 1 WHERE id_file = '" . $id_file . "'";
query($q);
$this->error = 6;
return false;
}
if (@unlink($this->root . "files" . $folderPath . SEP . $infoFile["file_name"])) {
$q = "DELETE FROM " . TABLE_PREFIX . "files WHERE id_file = '" . $id_file . "'";
query($q);
$q = "OPTIMIZE TABLE " . TABLE_PREFIX . "files";
query($q);
$this->updateFolderSize($infoFile["id_folder"], $infoFile["file_size"], "-");
$this->updateFolderTime($infoFile["id_folder"]);
return true;
}
return false;
}