OverviewObjectiveLearn the native features of validation in ProdigyView.Requirements Understanding of mime types Basic knowledge of the file managerEstimated Time8 Minutes www.prodigyview.com
Follow Along With Code Example1. 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
ValidationValidation is process of the checking data against a set ofparameters. If the parameters match, a true is returned,otherwise false.Validation can be used internally but it most commonlyused with checking user input.In this tutorial, we will be briefly introducing you tocommon validation used in PHP and its nativeimplementation in ProdigyView. www.prodigyview.com
Integer ValidationInteger validation is a good point to start. An exampleusage is many SQL databases use auto incremented idswhich are integers. You may want to verify that the id theyare going to use to update a record is an integer.
Double ValidationDouble validation will cover validation for types double,floats, longs, and anything else that contains a periodand a number. Passing an integer to double validationwill fail. www.prodigyview.com
Email ValidationA common validation with web applications is the email.You want the user who is registering for the application toat least enter a real email.
Audio File TypeOn your way to making the next Pandora? In that caseyou want audio file mime type validation. While theexample below checks all audio mime types, it can befurther specified to check only one type. Supported validation formats: mp3, wav, ra, oga, midi, aif
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, realvideo, asf, webm
Image File TypesCheck image file types before deciding to accept them.Below is the method checking all images types but theycan also be checked individually.Supported Validation Formats: png, gif, jpeg, ief, bmp,tiff
Compress FilesCompressed files include zip, tar and gtar. Validate thatthe file is actually a compressed file and does not merelyhave the extension of a compressed file. www.prodigyview.com
Microsoft FilesMicrosoft files include Word, Excel and Powerpoint. Dividedfurther, we have .doc, docx and so forth, each which hasdifferent mime-types. In ProdigyView, we can validateagainst any of those Microsoft file types. www.prodigyview.com
Other ValidationThis tutorial only showed a brief overview native validationin ProdigyView. There are many more validation typeavailable, read through the api.There is also the ability to add custom validation toPVValidator in the tutorial on ‘Custom Validation’. Other Native Validation Examples isValidUrl IsCSSFile isActiveUrl isPdf isID www.prodigyview.com
Challenge!This is optional challenge that will help you betterunderstand Validation and File Management.1. Located a video file on your computer/server.2. With PVFileManager, retrieve the mime type of the video file3. 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
API ReferenceFor a better understanding of Validation in ProdigyView, visitthe api by clicking on the link below.PVValidator More Tutorials For more tutorials, please visit: http://www.prodigyview.com/tutorials www.prodigyview.com