Upload class

From: Date: Mon, 02 Jul 2001 21:54:32 +0000
Subject: Upload class
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-530@lists.php.net to get a copy of this message
Hi there I've wrote a file Upload class with Pear in mind over the weekend and I'm not too sure what to do with it (and is there is any need for it in Pear?). Do I just jump on in and commit it to Experiemental or do I have to have it verified first? I've placed it on http://bealers.com/php/Upload.class.zip for your perusal (I still need to remove the Copyright notices) Does it cut it? I've endeavoured to follow the coding standards and it works, the only thing I still need to is implement the Pear error handling . regards Example code: <?php require_once("Upload.class.php"); $upload = new Upload(); $upload->printFormStart("index.php"); // put as many of these in as you want, // pass a string filename, else a default is used. $upload->printFormField(); print"<br />"; $upload->printFormField(); $upload->printFormSubmit(); $upload->printFormEnd(); if ($submit) { $upload->setAllowedMimeTypes(array("image/bmp","image/gif","image/pjpeg","im age/jpeg","image/x-png")); $upload->setUploadPath("/usr/local/apache/htdocs/uploads"); if ($upload->doUpload()) { print "Files Uploaded!"; } else { $errors = $upload->getUploadErrors(); // print "<strong>::Errors occured::</strong><br />\n"; while(list($filename,$values) = each($errors)) { "File: " . print $filename . "<br />"; $count = count($values); for($i=0; $i<$count; $i++) { print "==>" . $values[$i] . "<br />"; } } } } ?> -- Bealers mail at bealers dot com triple dub dot bealers dot com

« previous php.pear.dev (#530) next »