Sunday, February 01, 2009

CakePHP: Image Upload

Searching the web for some image upload component for cakePHP I found the following article: Image Upload Component (CakePHP) - Labs. Although this article is very useful, it was written over a year ago and unfortunately, the code of the image upload component available for download did not work straight away for me (I tested it using CakePHP Stable on xampp 1.7 for linux on Ubuntu 8.10). Some problems were: lack of index action in images controller, some unknown helpers (i.e. labelTag), missing model for images table, typo errors in view file upload.thtml, id field in images table was not a primary key, and some others. Three example screenshots are below:

Therefore, to make this component work I had to perform some modifications. Although, this component can be improved in may ways, I only made modifications necessary to make this component work. I did not perform full test of this componet. I just made it work, i.e. it is possible to upload images now (at least for me now).


The modified image upload component is here. Hope it works and it will be useful. In a similar way I also modified component for the multiple file upload. It can be downloaded from here.

1 comment:

  1. I have seen a very informative blog. Really I like this blog. This blog gives us very good knowledge about cake php development.