DooPHP IRC channel


DooDownload - A simple file downloader

Got a useful extension for DooPHP? Share it here...

DooDownload - A simple file downloader

Postby tripbr » Sun Oct 17, 2010 5:25 pm

Hello guyz!
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')
Attachments
DooDownload.zip
DooDownload plugin file.
(860 Bytes) Downloaded 248 times
Let's Doo::it
tripbr
 
Posts: 59
Joined: Thu Jun 24, 2010 2:21 pm

Return to Public Contributions

Who is online

Users browsing this forum: No registered users and 1 guest