Almost a year ago I posted something about the verot.net upload class. Now I’m learning Zend Framework and ZF doesn’t support image manipulation I’d like to add the upload class to ZF. Here’s how.
Step 1
Download the latest release of Upload Class from Colin Verot’s blog.
Step 2
Copy the file class.upload.php to your models directory and rename it to Upload.php
- Sitename
- application
- models
- Upload.php
- models
- application
Step 3
Edit the file Upload.php and change the following line (line 528 in version 0.29)
class upload {
to
class Application_Model_Upload { /* It's in the models directory remember? */
This is it
(It’s 25 June remember?
) To use the class just create a new instance and do the thinghies you did before!
$handle = new Upload($_FILES['my_field']);
if ($handle->uploaded) {
/* do thinghies */
}
If you’d like to read more about uploading files with Zend Framework I can recommend you this tutorial.
Cheers!




