Documentation

OnFileDelete

void
handler function(
 array arFile
);

The "OnFileDelete" event is called after deleting a file in the method CFile::Delete. The event can be used to delete files, derived from data file (created when uploaded thumbnail image and etc.).

Function parameters

Parameter Description
arFile Array with deleted file data, containing the following keys:
SUBDIR - subdirectory in the folder to upload files (usually in /upload);
FILE_NAME - deleted file name.

Returned value

Not used.

See Also

Examples of use

<?
AddEventHandler("main", "OnFileDelete", "MyOnFileDelete");
function MyOnFileDelete($arFile)
{
$fname = $_SERVER["DOCUMENT_ROOT"]."/upload/resize/".$arFile["SUBDIR"]."/small_".$arFile["FILE_NAME"];
if(file_exists($fname))
unlink($fname);

}

?>


© «Bitrix24», 2001-2022
Up