swfupload Swfupload is a power and flexible upload engine write on javascript and actionscript now combined with yii framework.

  1. Donate
  2. Documentation
  3. Change Log

SWFUpload is a small JavaScript/Flash library to get the best of both worlds. It features the great upload capabilities of Flash and the accessibility and ease of HTML/CSS now combined with the power of Yii framework.

SwfUpload

Resources

Donate

Documentation

THANKS TO PRADHAN WHO TOLD ME ABOUT ONE BUG. TO GET RID OF IT, IF YOU HAVE DOWNLOADED THE EXTENSION BEFORE, JUST CHANGE ONE LINE ON YOUR CODE:
'upload_success_handler'=>'js:uploadSuccessListView' TO 'upload_success_handler'=>'js:uploadSuccess'.
Requirements
  • Yii 1.0 or above
Installation
  • Extract the release file under protected/extensions
  • Put the code bellow and
Usage

See the following code example:

On controller

$filedata=$_FILES['Filedata'];
@move_uploaded_file($filedata['tmp_name'],'path/to/folder'); // Not relative. Full path

On Views

<?php
$this->widget('application.extensions.swfupload.CSwfUpload', array(
	'jsHandlerUrl'=>'path/to/handler.js', //Relative path
	'postParams'=>array(),
	'config'=>array(
		'use_query_string'=>true,
		'upload_url'=>'/path/to/controller/action', //Use $this->createUrl method or define yourself
		'file_size_limit'=>'2 MB',
		'file_types'=>'*.jpg;*.png;*.gif',
		'file_types_description'=>'Image Files',
		'file_upload_limit'=>0,
		'file_queue_error_handler'=>'js:fileQueueError',
		'file_dialog_complete_handler'=>'js:fileDialogComplete',
		'upload_progress_handler'=>'js:uploadProgress',
		'upload_error_handler'=>'js:uploadError',
		'upload_success_handler'=>'js:uploadSuccess',
		'upload_complete_handler'=>'js:uploadComplete',
		'custom_settings'=>array('upload_target'=>'divFileProgressContainer'),
		'button_placeholder_id'=>'swfupload',
		'button_width'=>170,
		'button_height'=>20,
		'button_text'=>'<span class="button">'.Yii::t('messageFile', 'ButtonLabel').' (Max 2 MB)</span>',
		'button_text_style'=>'.button { font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; font-size: 11pt; text-align: center; }',
		'button_text_top_padding'=>0,
		'button_text_left_padding'=>0,
		'button_window_mode'=>'js:SWFUpload.WINDOW_MODE.TRANSPARENT',
		'button_cursor'=>'js:SWFUpload.CURSOR.HAND',
		),
	)
);
?>

<?php echo CHtml::beginForm(); ?>
<div class="form">
	<div class="row">
    <div id="divFileProgressContainer"></div>
	<div class="swfupload"><span id="swfupload"></span></div>
    </div>
</div>
<?php echo CHtml::endForm(); ?>

Change Log

July 16, 2010
  • Initial release.
July 25, 2010
  • Solved bug on javascript handlers example file.
6 0
14 followers
8 716 downloads
Yii Version: 1.1
License: (not set)
Category: Others
Tags:
Developed by: thiagovidal
Created on: Jul 16, 2010
Last updated: 13 years ago

Downloads

show all