Can any one suggest me the best way to write code for uploading a file in CakePHP?
afterSave
callbackEdit (2015): Please see the Awesome CakePHP list for current file plugins (2.x branch here)
Edit (2013): This answer is now a bit dated, so I will just leave a list of all mentioned upload plugins:
Original answer (from 2010):
You might consider using the Media plugin that was talked about at the last CakeFest. It is fairly comprehensive, containing features such as creating file variations (ie. thumbnails of images or video), helpers for outputting different types of files, and elements to help create multiple-file upload forms more quickly; and also had a strong focus on security from the outset as I can gather from the slides. I use it in production and find it works well, plus it seems to be under more active development than other options I have seen if that's anything to go by (eg. MeioUpload behavior, Uploader plugin, FileUpload plugin and various Bakery/blog posts on the topic).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With