Hello friends,
Today we discuss how to delete a file in Joomla. In Joomla, delete() function is used to delete a file. This function perform various functionalities:
1. deletes a file
2. check permission of the file
3. If the file permission is not set, it will try to change the permission and delete the file.
Syntax:
JFile::delete($path.$file);
$path is the path of the file and $file is the name of the file.
Let's take an example to understand this.
<?php
$path=getcwd().'/';
$file='mydoc.txt';
JFile::delete($path.$file);
?>
In above example, $path is the path to the server and $file is the name of the file. mydoc.txt will be deleted after executing the script.
0 Comment(s)