This code is in Request section too, I just want to share whit everyone.
Name
DooDownload
Category
Plugin
Description
A very simple class that allow Doo users to download any file in the internet and store in the give path. The code was writen to consum minimal resources, I know that file_get_contents() it's a much simple way than Curl and fOpen, but try to download a 100Mb file from the internet and you memory will blow to the skys, but not whit this class.
Features
* Easy to Use - Just 3 lines of code and you can dowload everythg
* Header check - If the URL doesn't exist, this plugin will return de bolean false and will not download the file.
* Memory Comsumption - Curl working whit fOpen can write every bite directly to the disk and not to the memory like file_get_contents.
Usage
Download and extract the file attached to this post in your plugin's folder under your protected folder from your project. Now just load it and use like the example below:
- Code: Select all
// You can call the plugin inside you controllers
Doo::loadClass('DooDownload');
// Now initialize the object DooDownload
$down = new DooDownload();
// Thats it, just download the file now
$down->download('http://url_to_download/the_file.exe', '/path/to/store/thefile.exe')
