/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php class FileSystemService { private $filename; private $filepath; function __construct() { } /** * @return unknown */ public function getFilename() { return $this->filename; } /** * @param unknown_type $filename */ public function setFilename( $filename ) { $this->filename = $filename; } /** * @return unknown */ public function getFilepath() { return $this->filepath; } /** * @param unknown_type $filepath */ public function setFilepath( $filepath ) { $this->filepath = $filepath; } public function browseDirectory( $aPath, $aResultFormat = '' ) { { //loop files 'aFilename' => $file, 'aSize' => filesize ( $file ), 'aCreated' => filemtime ( $file ), 'aType' => filetype ( $file ), 'aDatabase' => '', 'aPermissions' => decoct ( fileperms ( $file ) ), 'isDir' => ( is_dir ( $file ) ) ? 'true' : 'false', 'isFile' => ( is_file ( $file ) ) ? 'true' : 'false', 'isReadable' => ( is_readable ( $file ) ) ? 'true' : 'false', 'isWritable' => ( is_writable ( $file ) ) ? 'true' : 'false' ); } } public function getDiskInfo( $aPath ) { //disk information ); return $diskInfoArray; } public function changePermissions( $whatDir, $aPermissions = 0755 ) { // Everything for owner, read and execute for others if ( $change ) { return true; } } public function createDirectory( $aFolder, $aPermissions = 0777 ) { if ( ! $newPath ) { echo 'Error creating folders'; } else { echo 'created'; } } public function removeFile( $whatDir, $whatFile ) { $filepath = "$whatDir/$whatFile"; $this->changePermissions ( $filepath, 0777 ); if ( $removeFile ) { return "$whatFile was removed."; } return 'There was a problem removing the file.'; } public function getFormattedDate( $aFile ) { return $newDate; } public function dump_var( $var ) { print "<pre>\n"; print "</pre>\n"; } } ?>