euploadify A wrapper for jquery Uploadify

  1. Documentation
  2. Change Log

This extension adds a flash based file-upload with progress-bar and multi-file upload capability. It implements all options of Uploadify (http://www.uploadify.com)

Note: the widget defaults to a single file auto-upload widget showing a single button with 'Browse' caption.

The only required options are:

name - name of the widget

script - the controller action to call when the file(s) are received.

Documentation

Requirements
  • Yii 1.0.9 or above (have not tested with lower versions)
Installation
  • Extract the release file under protected/extensions
Usage

See http://www.uploadify.com/download/ for a full description of all options

See the following code example:

<?php 
$this->widget('application.extensions.uploadify.EuploadifyWidget', 
	array(
		'name'=>'uploadme',
		'options'=> array(
			//'uploader' => '/js/uploadify.swf',
			'script' => $this->createUrl('test/UploadedFiles'), 
			'cancelImg' => '/js/cancel.png',
			'auto' => true,
			'multi' => false,
			'folder' => '/tmp',
			'scriptData' => array('extraVar' => 1234, 'PHPSESSID' => session_id()),
			//'fileDesc' => 'Declaratiebestanden',
			//'fileExt' => '*.*',
			'buttonText' => 'Upload bestanden',
			'buttonImg' => '/images/upload.gif',
			'width' => 150,
			),
		'callbacks' => array( 
		   'onError' => 'function(evt,queueId,fileObj,errorObj){alert("Error: " + errorObj.type + "\nInfo: " + errorObj.info);}',
		   'onComplete' => 'function(){alert("Complete");}',
		   'onCancel' => 'function(evt,queueId,fileObj,data){alert("Cancelled");}',
		)
	)); 
?> 

And put the following code in your controller:

public function actionUploadedFiles()
{
    // flash does NOT pass the session
    // thus we pass the id with a $_POST variable
    Yii::app()->session->sessionID = $_POST['PHPSESSID'];
    Yii::app()->session->init();
    
    // Do whatever you need to do with the files you just received
    $files = var_export($_FILES, true);
    $this->log('Files ' . $files);
    echo 1;
}

Change Log

November 25, 2009
  • Initial release.
    November 30, 2009
  • version 1.01 - bug fix for IE
11 1
5 followers
4 722 downloads
Yii Version: 1.1
License: (not set)
Category: User Interface
Tags:
Developed by: mbetel
Created on: Nov 25, 2009
Last updated: 8 years ago

Downloads

show all