How to upload a file like image, video and audio
- zendnwar
- May 7, 2012
- Zend basic
- 0 Comments
just follow the instruction i hope will be work nicely.
At first create a url path for upload.
public/index.php
defined ( ‘UPLOAD_PATH’ ) || define ( ‘UPLOAD_PATH’, realpath ( dirname ( __FILE__ ) . ‘/../docs’ ) );// “/../docs” your file location where u want to upload your file.
In your form just add below element tag.
$image = new Zend_Form_Element_File ( ‘image’ );
$image->setLabel ( ‘Upload Thumnail Image:’ )
->setDestination ( UPLOAD_PATH . ‘/uploads’ )
->setRequired ( true )
->addValidator ( ‘Extension’, false, ‘jpg,jpeg,png,gif’ ); //here only for image file extension will be accept.
If u have any query please reply me.