PHP5 Universal File Download Class
After finding different hosting companies having wildly different policies when it comes to what's enabled and what isn't in PHP, I've built a generic file download class which should work in almost all situations.
This is the first version so there are some improvements to be made and if you download it, you'll see where some improvements may be made. I will be releasing another version when I've had time to do some further work on it. For now you can find the source code plus any community improvements here: http://www.refactormycode.com/codes/440-universal-file-download-class
I should also mention that this class has been cleaned of some application specific code, so if there's any disjointed bits I apologise - I have tried to deal with any discontinuities before posting but there may be something i've missed (this is also the reason for the bunch of if's in get_file() if you are to use this as is you may want to replace them with your own custom code).
Related posts on coderchris.com:
- Simple Function To Force Download Of A File
The following function will allow you to run a file download through PHP, you could... - File-system mp3 Organisation – Is It Really That Hard?
Like most people I know I have a lot of mp3's and every person likes... - Why @ is NOT your friend
Ah, the error suppression operator (@) It seems like such a fantastic idea, just put... - Starting App’s For Facebook
Yesterday for a bit of fun I decided I'd try and write my first application... - Funky ORM with PHPDoctrine
I work on all sorts of little personal projects in my spare time, most of...

Also Find Me On