UploadPack - easy and flexible way to upload files with CakePHP
I have seen and worked with many scripts and plugins (not only written in PHP) that tries to deal with file-upload functionality on server side, thanks to this I think I have some view on how good file-upload plugin should work. The thing was to put it in CakePHP clothes and code it.
Here are the requirements I set:
- save procedure of record with attached file should be no different to usual record
- it should be possible to do some additional processing of uploaded file at the time of saving it (for example thumbnail generation)
- easy access to uploded file, it’s URL and alternatives (different thumnails) from view level
- everything should require no or minimum configuration to work, but still remain flexible if the whole application needs it
- natural integration with CakePHP framework
Here’s the effect of some planning and coding - UploadPack. Right now it contains:
- UploadBehavior - deals with saving files to disk and post-save processing
- UploadHelper - provides nice access to files (URLs, thumbnails) from view level
Everything works quite gracefully, I think. You only need to add one field to model’s database table (which will hold file name) and attach behavior to model. The rest is done automatically. Everything is documented on repository’s page.
It’s still an early version - 0.1, but there is much it can do right now. The work is underway to provide new features. Take a look at it.
If you have any views or ideas, please leave a comment. I’d appreciate it.
Related posts
3 Responses to 'UploadPack - easy and flexible way to upload files with CakePHP'
Sorry, comments are closed for this post.

Hi Michal, the link to your UploadPack returns
503 Service Unavailable.
When I was solving the upload file riddle I used uploadable behaviour based on the code of iamkoa labs and Ben Borowski, modified to a behaviour by Stefan Schmidt. http://bin.cakephp.org/saved/33249
Have you had a look at MeioUpload Behavior? Is your code better?
PePa
Petr 'PePa' Pavel
7 Nov 08 at 10:58
Hi,
repository is hosted on GitHub, I believe the service should be back shortly.
My UploadBehavior is able to generate many thumbnails at once, also you’ll be soon able to regenerate thumbnails at later time if you decide that you need more sizes. There is also nice path configuration and a helper which helps to display files. I thinks these are main advantages, but of course you should definitely check other plugins too and choose the one that suits you best.
Michał
Michał Szajbe
7 Nov 08 at 11:15
Very nice, indeed. Please keep up the good work.
Mohamed Zeid
20 Nov 08 at 21:15