PHP 클래스 Files

상속: extends Controller
파일 보기 프로젝트 열기: sourcefabric/newscoop 1 사용 예제들

공개 메소드들

메소드 설명
copyFile ( string $source, string $destination_dir, string $destination_file, boolean $unique = true ) : string Copy a file from source to destination. If unique == true, then if the destination exists, it will be renamed by appending an increamenting counting number.
createFolder ( string $newFolder ) : boolean Create a new folder.
delFile ( string $file ) : boolean Delete a file.
delFolder ( string $folder, boolean $recursive = false ) : boolean Delete folder(s), can delete recursively.
escape ( string $filename ) : string Escape the filenames, any non-word characters will be replaced by an underscore.
fixPath ( string $path ) : string Append a / to the path if required.
formatSize ( integer $size ) : string Format the file size, limits to Mb.
makeFile ( string $pathA, string $pathB ) : string Similar to makePath, but the second parameter is not only a path, it may contain say a file ending.
makePath ( string $pathA, string $pathB ) : string Concat two paths together. Basically $pathA+$pathB

메소드 상세

copyFile() 공개 메소드

Copy a file from source to destination. If unique == true, then if the destination exists, it will be renamed by appending an increamenting counting number.
public copyFile ( string $source, string $destination_dir, string $destination_file, boolean $unique = true ) : string
$source string where the file is from, full path to the files required
$destination_dir string where the files, just the destination dir, e.g., /www/html/gallery/
$destination_file string name of the new file, just the filename
$unique boolean create unique destination file if true.
리턴 string the new copied filename, else error if anything goes bad.

createFolder() 공개 메소드

Create a new folder.
public createFolder ( string $newFolder ) : boolean
$newFolder string specifiy the full path of the new folder.
리턴 boolean true if the new folder is created, false otherwise.

delFile() 공개 메소드

Delete a file.
public delFile ( string $file ) : boolean
$file string file to be deleted
리턴 boolean true if deleted, false otherwise.

delFolder() 공개 메소드

Delete folder(s), can delete recursively.
public delFolder ( string $folder, boolean $recursive = false ) : boolean
$folder string the folder to be deleted.
$recursive boolean if true, all files and sub-directories are delete. If false, tries to delete the folder, can throw error if the directory is not empty.
리턴 boolean true if deleted.

escape() 공개 메소드

Escape the filenames, any non-word characters will be replaced by an underscore.
public escape ( string $filename ) : string
$filename string the orginal filename
리턴 string the escaped safe filename

fixPath() 공개 메소드

Append a / to the path if required.
public fixPath ( string $path ) : string
$path string the path
리턴 string path with trailing /

formatSize() 공개 메소드

Format the file size, limits to Mb.
public formatSize ( integer $size ) : string
$size integer the raw filesize
리턴 string formated file size.

makeFile() 공개 메소드

Similar to makePath, but the second parameter is not only a path, it may contain say a file ending.
public makeFile ( string $pathA, string $pathB ) : string
$pathA string the leading path
$pathB string the ending path with file
리턴 string combined file path.

makePath() 공개 메소드

Concat two paths together. Basically $pathA+$pathB
public makePath ( string $pathA, string $pathB ) : string
$pathA string path one
$pathB string path two
리턴 string a trailing slash combinded path.