Class FileserverV2
Takes care of all file handling to and from the image area (version 2).
Namespace: hrm
Package: hrm
Located at FileserverV2.php
Methods summary
public static
boolean
|
#
moveUploadedFile( string $file, string $destDir, string & $errorMessage )
Move uploaded file to its final destination.
Move uploaded file to its final destination.
If the file is an archive, it will also be decompressed.
Parameters
- $file
- Full path of the file to be moved.
- $destDir
- Full path to the destination directory.
- $errorMessage
- Reference to a string to store error messages.
Returns
boolean True if moving was successful, false otherwise.
|
public static
boolean
|
#
decompressArchive( string $file, string $destDir )
Extract files from supported archive.
Extract files from supported archive.
Parameters
- $file
- Archive file with full path.
- $destDir
- Destination folder where the archive will be extracted.
Returns
boolean True if the decompression was successful, false otherwise.
|
public static
boolean
|
#
isArchiveFile( string $fileName )
Check whether the file name has one of the recognized archive extensions.
Check whether the file name has one of the recognized archive extensions.
The recognized extensions are defined in the hrm_{servver}client}_config.inc files as $decompressBin.
Parameters
- $fileName
- File Full file name of the file to check.
Returns
boolean True if the file is an a supported archive, false otherwise.
|
public static
array
|
#
getAllValidExtensions( boolean $withLeadingDot = false )
Return all valid extensions.
Return all valid extensions.
Valid extensions and image extensions, extra extensions, archive extensions.
Parameters
- $withLeadingDot
- Set to true to return the extensions with a leading 'dot'.
Returns
array of extensions.
|
public static
array
|
#
getImageExtensions( )
Return all valid image extensions.
Return all valid image extensions.
Returns
array of image extensions.
|
public static
array
|
#
getArchiveExtensions( )
Return all archive extensions.
Return all archive extensions.
Returns
array of archive extensions.
|
public static
boolean
|
#
isValidImage( string $filename, boolean $alsoExtras = false )
Check whether the file is of supported format.
Check whether the file is of supported format.
Parameters
- $filename
- File name to be checked.
- $alsoExtras
- If true consider also "ids" and "ids.gx" as supported formats.
Returns
boolean True if the file name is supported, false otherwise.
|
public static
string
|
#
getFileNameExtension( string $filename )
Get file extension in a robust way.
Get file extension in a robust way.
Double extensions (as in .ome.tif) are correctly returned. There
is no support for longer, composite extensions because they do not
occur in practice.
Parameters
- $filename
- Filename to be processed.
Returns
string Complete extension.
|
public static
string
|
#
getFileBaseName( string $filename )
Get file base name.
Parameters
- $filename
- Filename to be processed.
Returns
string Base name.
|
public static
|
#
removeDirAndContent( string $dir )
Recursively delete a folder and all its content.
Recursively delete a folder and all its content.
Parameters
- $dir
- Directory to be deleted.
|
public static
|
#
createUpDownloadFolderIfMissing( )
Create the download and upload (chunk and files) folder if they do not exist.
Create the download and upload (chunk and files) folder if they do not exist.
The folder paths are taken from inc/hrm_config.inc.php (advanced parameters).
|