0

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;
}

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by mayreeh
0

1) Is

$this->root . "files" . $folderPath . SEP . $infoFile["file_name"]

pointing to the file correctly (no problems with path / filename)?

2) Replace @unlink with unlink -> @ symbol suppresses errors, you might wanna see all the errors while debugging

Edited by touch_the_sky: n/a

0

using @ and not using makes no defference... still not deleteing, pliz help

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.