Commits

christiansalazar  committed 35bd4e8

Client-Side size validation, deny file upload if sizeLimit is reach.

  • Participants
  • Parent commits afd07f7

Comments (0)

Files changed (3)

+.swp
+*.swp
+*.tmp

File CocoWidget.php

 
 		$vars = array(
 			'allowedExtensions'=>$this->allowedExtensions,
-			'sizeLimit'=>$this->sizeLimit,
+			'sizeLimit'=>$this->sizeLimit,	// server-side size validation
 			'uploadDir'=>$this->uploadDir,
 			'receptorClassName'=>$this->receptorClassName,
 			'methodName'=>$this->methodName,
 				'buttonText'=>$this->buttonText,
 				'dropFilesText'=>$this->dropFilesText,
 				'uploaderContainer'=>$upid,
+				'sizeLimit'=>$this->sizeLimit, // for client-side size validt.
 				//'data'=>serialize($vars),
 			)
 		);

File assets/cocowidget.js

 	this.run = function(){
 		var _this = this;
 		var _uploader = new qq.FileUploader({
+			sizeLimit: options.sizeLimit,	// client side size validation
 			buttonText: options.buttonText,
 			dropFilesText: options.dropFilesText,
 			element: document.getElementById(options.uploaderContainer),
-			//action: options.action + '&action=upload' + _this.nocache() + '&data='+options.data,
 			action: options.action,
 			onComplete: _this.onComplete,
 			onCancel: _this.onCancel,