2. Overview
Objective
Learn the native features of validation in ProdigyView.
Requirements
Understanding of mime types
Basic knowledge of the file manager
Estimated Time
8 Minutes
www.prodigyview.com
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/Validation.php
4. Validation
Validation is process of the checking data against a set of
parameters. If the parameters match, a true is returned,
otherwise false.
Validation can be used internally but it most commonly
used with checking user input.
In this tutorial, we will be briefly introducing you to
common validation used in PHP and its native
implementation in ProdigyView.
www.prodigyview.com
5. Integer Validation
Integer validation is a good point to start. An example
usage is many SQL databases use auto incremented ids
which are integers. You may want to verify that the id they
are going to use to update a record is an integer.
6. Double Validation
Double validation will cover validation for types double,
floats, longs, and anything else that contains a period
and a number. Passing an integer to double validation
will fail.
www.prodigyview.com
7. Email Validation
A common validation with web applications is the email.
You want the user who is registering for the application to
at least enter a real email.
8. Audio File Type
On your way to making the next Pandora? In that case
you want audio file mime type validation. While the
example below checks all audio mime types, it can be
further specified to check only one type.
Supported validation formats:
mp3, wav, ra, oga, midi, aif
9. Video File Types
Similar to the audio file type, video mime types can also be
validated. The example below is also all inclusive but video mime
types can be checked individually.
Supported Validation Formats:
ogv, mpeg, wmv, mp4, flv, quicktime, mov, mxu , avi, real
video, asf, webm
10. Image File Types
Check image file types before deciding to accept them.
Below is the method checking all images types but they
can also be checked individually.
Supported Validation Formats: png, gif, jpeg, ief, bmp,
tiff
11. Compress Files
Compressed files include zip, tar and gtar. Validate that
the file is actually a compressed file and does not merely
have the extension of a compressed file.
www.prodigyview.com
12. Microsoft Files
Microsoft files include Word, Excel and Powerpoint. Divided
further, we have .doc, docx and so forth, each which has
different mime-types. In ProdigyView, we can validate
against any of those Microsoft file types.
www.prodigyview.com
13. Other Validation
This tutorial only showed a brief overview native validation
in ProdigyView. There are many more validation type
available, read through the api.
There is also the ability to add custom validation to
PVValidator in the tutorial on ‘Custom Validation’.
Other Native Validation Examples
isValidUrl IsCSSFile
isActiveUrl
isPdf
isID www.prodigyview.com
14. Challenge!
This is optional challenge that will help you better
understand Validation and File Management.
1. Located a video file on your computer/server.
2. With PVFileManager, retrieve the mime type of the
video file
3. Check against the file type specifically. Example, if the
video file is an avi, validate ONLY against avi files.
4. If the validation passed, copy the file to another
location using PVFileManager.
www.prodigyview.com
15. API Reference
For a better understanding of Validation in ProdigyView, visit
the api by clicking on the link below.
PVValidator
More Tutorials
For more tutorials, please visit:
http://www.prodigyview.com/tutorials
www.prodigyview.com