/** * deletedirfile * * deletes a file from a web directory * * @param object $filespec * file data */ function deletedirfile($filespec) { $ds = DIRECTORY_SEPARATOR; $filepath = EASYCONTACTFORMS__fileUploadDir . $ds . $filespec[0]->Doctype . $ds . $filespec[0]->Docid . $ds . $filespec[0]->Docfield . $ds . $filespec[0]->Storagename; if (is_file($filepath)) { unlink($filepath); } $dir = EASYCONTACTFORMS__fileUploadDir . $ds . $filespec[0]->Doctype . $ds . $filespec[0]->Docid . $ds . $filespec[0]->Docfield . $ds; $filepath = $dir . $ds . 'index.html'; if (is_file($filepath)) { unlink($filepath); } if (is_dir($dir)) { @rmdir($dir); } $dir = EASYCONTACTFORMS__fileUploadDir . $ds . $filespec[0]->Doctype . $ds . $filespec[0]->Docid; if (EasyContactFormsUtils::hasMoreFiles($dir, array('index.html'))) { return; } $filepath = $dir . $ds . 'index.html'; if (is_file($filepath)) { unlink($filepath); } if (is_dir($dir)) { @rmdir($dir); } }