Skip to content

Latest commit

 

History

History
36 lines (31 loc) · 1.31 KB

README.md

File metadata and controls

36 lines (31 loc) · 1.31 KB

Ajax File Upload Component for CakePHP 2.x

This component is created using FineUploader

Instruction for use:

Copy css,js and imaged to their respective folders.
Copy AjaxFileUploadComponent.php to component folder.

Basic Example :

<div id="fine-uploader">
<noscript>
    <p>Please enable JavaScript to use Fine Uploader.</p>
    <!-- or put a simple form for upload here -->
</noscript>
</div>
$('#fine-uploader').fineUploader({
    request: {
        endpoint: '/controller/action'
    }
}).on('error', function(event, id, filename, reason) {
     //do something
  })
  .on('complete', function(event, id, filename, responseJSON){
    //do something
  });
In your action, use it as :
return $this->AjaxFileUpload->uploadFiles('files/',$this->permitted);
where permitted is : $permitted = array("jpeg","bmp","jpg","png");

You can find detailed documentation about file uploader here.