Technical skills, technology news, analysis ….

Main menu

Post navigation

How to integrate uploadify in Zend Framework 1.9.6

A detailed tutorial will show you how to integrate Zend Framework version 1.9.6 with jQuery Uploadify version 2.1.0. The tutorial covers all the basic aspects of the process from installing the framework on a multi zend applications with the same library/separate configurations system to integrating the jQuery Uploadify into your website. The uploads will be made in a secure folder, outside the public area of your server from where you can manipulate the files as you wish.

In a previous post, i talked about integrating the script jQuery Uploadify into the CakePHP framework. Today, i will show you how to integrate it into Zend Framework 1.9.6.
Our goal is simple: create a new zend application that uses a common library, gets its configuration files from a custom location and integrate it with Uploadify

Application folders & the public files

First of all, you will need to download the Zend Framework. You can download it from the Zend site here. In this tutorial, i will work with the 1.9.6 version of the framework.

We will now create our directory structure for the framework.

Create a folder in /var/www/public_html/uploadify/ named public.

Create two folders in /var/www/ named application and library.

Inside the library folder, create a new folder named 1.9.6. Inside this folder, add your Zend library folder, so you would have /var/www/library/1.9.6/Zend.

In your public folder add a file named index.php with the following contents:

Add a new file called .htaccess here with the following contents:
[file]http://phpdev.ro/wp-content/code_snippets/how-to-integrate-uploadify-in-zend-framework-1-9-6/2.php[/file]
Create a folder named scripts and a folder named images. Inside the scripts put the jQuery library, the jQuery.uploadify.v2.1.0.min.js, the swfobject.js and create a new file named scripts.js.

Create a folder in your APPLICATION_PATH named uploads and make it writable by PHP (ex: chmod 0777).

What have we done so far?Now, we basically have an application that displays a nice empty page with the uploadify script included, have all the JS code in external files and JS variables that contain dynamic data (aka PHP variables) in our main layout.

The application views

Make sure you have the folder uploadify in your /views/scripts/ folder and inside it the files index.phtml and upload.phtml .

Inside the index.phtml make sure you have the following line somewhere (where you want to have the uploadify generated) :

Inside your layout.phtml make sure you have the following code (stripped so it can be displayed properly):
[file]http://phpdev.ro/wp-content/code_snippets/how-to-integrate-uploadify-in-zend-framework-1-9-6/7.php[/file]

Conclusion

Now, everything should work. If you browse your application at example.com/uploadify/ you should see the uploadify button here.

If you have any problems implementing the tutorial, feel free to contact me via comments below and I’ll try to help you fix them.