Tag Archives: cahephp

File Upload in CakePHP

In this post I will describe how to upload images in CakePHP. It will automatically upload and move the uploaded file to the wanted location. It will automatically rename the file if there is another file with same name exist. A lot of other features are also available.

  • Download Upload Component file and copy it to the location app/Controller/Component/UploadComponent.php
  • Initialize
  • Your add action would looks like:
  • We have setup our controller. Now its time to setup view file add.ctp. The file file should look like following:
  • All done.

UploadComponent class file is well document so you can always find all configuration setting for the uploaded images.