2. Overview
Objective
Learn about the other features of file management in
ProdigyView
Requirements
Understanding of the DEFINES
Basic knowledge of the file manager
Estimated Time
5 Minutes
3. Follow Along With Code Example
1. Download a copy of the example code at
www.prodigyview.com/source.
2. Install the system in an environment you feel
comfortable testing in.
3. Proceed to examples/util/FileManagement2.php
4. File Mime Type
There will be various times, and most likely during file
uploads, that a file’s mime type will be checked. That can
be accomplished with the method getFileMimeType().
6. File Size - Perl
To get the size of a file, we could simply use php’s filesize()
function. Or we could use the outside language of perl to get
the file size for us. If you are on Windows, you can utilize a
method called getFileSize_NTFS().
8. Files in Directory
Quite possibly the coolest function in the FileManager is
getFilesInDirectory() function. It will return all files and
folders in a directory.
Retrieve all files in the location of PV_CORE define
10. Files In Directory Verbose
An option to retrieve a detailed list of the files in a
directory is the verbose option. It will return information
such as mime type, extension and other useful
information.
Set verbose to true
11. File in Directory Verbose
An abbreviated verbose list of the files in the PV_CORE
folder.
File Location File Information
12. Last File In Directory
If you ever have had the need and the frustration of
finding the latest file in a directory, be frustrated no more.
The ability to do this is a simple line of code.
Get the newest file in the define of PV_CORE
13. Challenge!
This is an optional challenge to help you better
understand file management in ProdigyView.
1. Pick a directory you want to retrieve all the files and
folders in.
2. Read that directory in verbose mode into
PVFileManager::getFilesInDirectory().
3. If the file is a directory, make a link that opens the
directory. If the file is a file, read the contents of the file
in with PVFileManager::readFile().
4. Get the newest file that has been added
14. API Reference
For a better understanding of file management in
ProdigyView, visit the api by clicking on the link below.
PVFileManager
More Tutorials
For more tutorials, please visit:
http://www.prodigyview.com/tutorials
www.prodigyview.com