references:joomla.framework:filesystem:jfile-deletedelete
Delete a file or array of files. If FTP is enabled and safe mode is on or the file(s) are unwritable by the web server user, then the function will use FTP to delete the file(s). Otherwise, the function will use the PHP unlink function. The function returns true if all files were deleted. Otherwise, it returns false. Syntaxboolean delete ( $file )
ExamplesExample 1: This example deletes a file. Example 1 if (JFile::delete( 'images/stories/clock_copy.jpg' )) { echo "<h3>File(s) Successfully Deleted</h3>"; } else { echo "<h3>Could not delete one or more files</h3>"; } Example 2: This example deletes two files. Example 2 $files = array( 'images/stories/clock_copy1.jpg', 'images/stories/clock_copy2.jpg' ); if (JFile::delete( $files )) { echo "<h3>File(s) Successfully Deleted</h3>"; } else { echo "<h3>Could not delete one or more files</h3>"; } Discussion |


