wkd-media-uploader Yii module/component to quickly add file uploader support to any model.

Webkadabra Media Uploader

  1. 1. Preparation
  2. Usage Example
Author: Sergii Gamaiunov hello@webkadabra.com
http://webkadabra.com

Download

  1. 1. Preparation
  2. Usage Example

Get source from https://bitbucket.org/webkadabra/wkd-yii-mediauploader

Installation

  1. 1. Preparation
  2. Usage Example

1. Preparation

  1. Copy contents of this folder to /path/to/extensions/wkd/components/media-uploader folder

  2. Install MySql schema

See database.sql

  1. Make sure your Yii application has 'wkd' path alias pointed to /path/to/extensions/wkd/

  2. Usage Example

  3. Add MediaUploader to Controller map in app config:

	'controllerMap'=>array(
		'mediaUploader'=>array(
			'class'=>'wkd.components.media-uploader.MediaUploaderController',
		),
	),
  1. Add path alias for tmp uploads folder in config:
	'params'=>array(
		...
		'envTempDir' => 'application.runtime', // uploader temp folder
	),
  1. In your views, add uploader widget:

	// Uploader, Must be called before RTEditor:
	$this->widget('wkd.components.media-uploader.MediaUploaderWidget', array(
		'options' => array(
			'uploadUrl' => app()->createUrl('mediaUploader/upload', array('modelName' => get_class($model), 'modelID' => $model->id)),
			'browseUrl' => app()->createUrl('mediaUploader/index', array('modelName' => get_class($model), 'modelID' => $model->id)),
		),
		'boundModel' => $model,
		#'forceAssetsCache'=>true,
	));
  1. To open up an uploader window, call Javascript helper function mediaUploaderWindow.open()
1 0
2 followers
0 downloads
Yii Version: Unknown
License: (not set)
Category: User Interface
Tags:
Developed by: Webkadabra
Created on: Feb 4, 2014
Last updated: 4 years ago