Thread: [pLog-CVS] plog/class/gallery/dao galleryresources.class.php,1.6,1.7
Brought to you by:
jondaley
From: <phu...@us...> - 2003-12-29 00:23:27
|
Update of /cvsroot/plog/plog/class/gallery/dao In directory sc8-pr-cvs1:/tmp/cvs-serv6331/class/gallery/dao Modified Files: galleryresources.class.php Log Message: Added support for the UploadValidator class, so that we can make sure that the user is not uploading files that havea forbidden extension (e.g. .php, .phtml and so on) or that the resource we're trying to upload is too big. Index: galleryresources.class.php =================================================================== RCS file: /cvsroot/plog/plog/class/gallery/dao/galleryresources.class.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** galleryresources.class.php 29 Dec 2003 00:08:26 -0000 1.6 --- galleryresources.class.php 29 Dec 2003 00:23:19 -0000 1.7 *************** *** 102,105 **** --- 102,117 ---- function addResource( $ownerId, $albumId, $description, $upload ) { + // first of all, validate the file using the + // upload validator class. It can return + // UPLOAD_VALIDATOR_ERROR_UPLOAD_TOO_BIG (-1) + // or + // UPLOAD_VALIDATOR_ERROR_FORBIDDEN_EXTENSION (-2) + // in case the file is not valid. + $uploadValidator = new UploadValidator(); + $error = $uploadValidator->validate( $upload ); + if( $error < 0 ) { + return $error; + } + // get the metadata $metadata = GetAllFileInfo( $upload->getTmpName()); |