ajaxuploader This is meant to upload and resize an image via ajax


  1. Requirements
  2. Usage
  3. Resources

PLAESE DOWNLOAD THE ajaxuploader_1.2.zip (the updated version of this module) not the first one.

This module is for uploading and resizing an image through ajax. Both images are saved on the server. The UploadController.php saves the filename in the database. The module assumes that the model to save the image filename has Yii::app()->user->id as the PK. You can change it in the UploadController.

The validation for the file is done both server-side and client-side. The rules for the file to upload are done in the /ajaxuploader/models/UploadModel.php(server-side) rules and in the /ajaxuploader/assets/js/processupload.js(client-side). UploadModel extends CFormModel.

The DOM element to output the uploaded image to is #output in the /ajaxuploader/assets/js/processupload.js. Make an element in your view to have this id or uncomment line 48 in /ajaxuploader/widgets/views/uploadform.php(to output the image on the modal)


Tested with Yii 1.1.13 but should work with earlier versions.

Yii bootstrap 2.3 or above


Extract the files under /protected/modules.

Import the following in the /protected/config/main.php


	* configuration for ajaxuploader
		'userModel'=>'Biodata',  //change to the model that has the pix column
		'userPixColumn'=>'pix',  //column to save the filename
	   'folder'=>'images', //the dest folder(should be in the same folder level as protected folder)

The upload form is in bootstrap modal. so add this to the htmlOptions of any element that would be clicked to trigger the modal

(data-target="#upload" data-toggle="modal")  // the id of the modal is #upload

Add this widget to the view where you have the above

         $this->widget('Uploader');  //for the upload form		 


External resources for this extension...

2 0
2 199 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Web Service
Developed by: IsraelAma
Created on: Feb 19, 2014
Last updated: 10 years ago


show all

Related Extensions