PHPackages                             jkuchar/filedownloader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. jkuchar/filedownloader

ActiveLibrary[File &amp; Storage](/categories/file-storage)

jkuchar/filedownloader
======================

Addon makes controlled downloads of files peace of cake. It supports client reconnections, segmented downloading, files over 4GB, automatic mime-type detection and special characters in file names. If you need to control download speed you are on the right site.

v1.2.3(9y ago)2730.7k10[4 issues](https://github.com/jkuchar/FileDownloader/issues)[1 PRs](https://github.com/jkuchar/FileDownloader/pulls)1New BSD LicensePHPPHP &gt;= 5.3.0

Since Sep 18Pushed 6y ago4 watchersCompare

[ Source](https://github.com/jkuchar/FileDownloader)[ Packagist](https://packagist.org/packages/jkuchar/filedownloader)[ RSS](/packages/jkuchar-filedownloader/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (5)Dependencies (2)Versions (9)Used By (1)

File Downloader
===============

[](#file-downloader)

[![Code Climate](https://camo.githubusercontent.com/4c69213d9698f35f0e30442071624f6520eb57ba321ba3fca8f2a48ba31e0d9d/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6a6b75636861722f46696c65446f776e6c6f616465722f6261646765732f6770612e737667)](https://codeclimate.com/github/jkuchar/FileDownloader)

**looking for new maintainer(s)** Please use [Nette\\Application\\Responses\\FileResponse](https://api.nette.org/2.4/Nette.Application.Responses.FileResponse.html) instead. Or hi-speed solution [X-Accel/NGINX](https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/) or [X-Sendfile/Apache](https://tn123.org/mod_xsendfile/).

Addon makes controlled downloads of files peace of cake. It supports **client reconnections**, **segmented downloading**, files **over 4GB**, automatic **mime-type detection** and **special characters** in file names. If you need to **control download speed** you are on the right site.

- License: New BSD License
- [Discussion](http://forum.nette.org/cs/1952-addon-file-downloader-file-downloader)
- [Demo](http://filedownloader.projekty.mujserver.net/demo/)

Installation
------------

[](#installation)

Install this addon just by calling: `composer require jkuchar/filedownloader`

Or to install example, continue to [example repository](https://github.com/jkuchar/FileDownloader-example). (one command set-up)

Basic usage: Just want to download file
---------------------------------------

[](#basic-usage-just-want-to-download-file)

Import FileDownloader from it's namespace

```
use FileDownloader\FileDownload;
```

And use

```
$filedownload = new FileDownload;
$filedownload->sourceFile = "source.txt";
$filedownload->download();

// or the same thing using fluent-interface
FileDownload::getInstance()
	->setSourceFile("source.txt")
	->download();
```

Advanced usage: combination of advanced features
------------------------------------------------

[](#advanced-usage-combination-of-advanced-features)

```
$filedownload = new FileDownload();
$filedownload->sourceFile = "source.txt";

// apply speed limit (in this case in bytes per second)
$filedownload->speedLimit = 5 * FDTools::BYTE;

// set filename that will be seen by user
$filedownload->transferFileName = "test.txt";

// set mime-type manually (you normally do not need to so this!)
$filedownload->mimeType = "application/pdf";

// show this file directly in browser (do not download it)
$filedownload->contentDisposition =	FileDownload::CONTENT_DISPOSITION_INLINE;

$filedownload->download();
```

The same thing using fluent-interface:

```
FileDownload::getInstance()
	->setSourceFile("source.txt")
	// Nastavíme rychlost odesílání v bytech
	->setSpeedLimit(5*FDTools::BYTE)
	->setTransferFileName("test.txt")
	->setMimeType("application/pdf")
	->setContentDisposition(
		FileDownload::CONTENT_DISPOSITION_INLINE
	)
	->download();
```

Callbacks
---------

[](#callbacks)

When... ...download is cancelled ...download failed ...download succeded etc.

```
$filedownload->onAbort[] = "onAbortHandlerFunction"; // here is everything callable accepted

// fluent-interface
FileDownload::getInstance()->addAbortCallback("onAbortHandlerFunction")

// Callback parameters are always the same
function onAbort(FileDownload $download,IDownloader $downloader){
	/* ... */
}
```

Callback nameDescriptionBeforeDownloaderStartsBefore downloader startsBeforeOutputStartsBefore output to browser starts (last chance to modify HTTP headers)StatusChangeWhen file download status changes (when block of file is sent or every second if there is no speed limit)CompleteWhen file download is finishedAbortWhen file download is aborted (user clicks cancel)ConnectionLostWhen connection is lost (for whatever reason)TransferContinueWhen paused transfer continues (this is start event for partial downloads)NewTransferStartWhen new transfer from beginning starts (this is start event for downloads from beginning)In repository there is example *form* that prints on screen all called callbacks.

Technical requirements
----------------------

[](#technical-requirements)

There are two downloaders **AdvancedDownloader** requires to set infinite time limit (tries to do so automatically). As fallback there is **NativePHPDownloader** available, this downloader requires as much memory as is file size on some PHP installtions. (php bug: if you've found solution, please let me know)

Callbacks, speed controlling and support for big files is only for **AdvancedFileDownloader**!

Support for huge files (over 4 GB)
----------------------------------

[](#support-for-huge-files-over-4-gb)

- This is realized through **cURL extension** so please do not forget to enable it. Addon will work also without CURL but very inefficiently.
- Support for &gt;4GB files also requires to add [BigFileTools](https://github.com/jkuchar/BigFileTools) into your libraries (do that using composer)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 96.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~230 days

Total

5

Last Release

3386d ago

Major Versions

v1.2.3 → v2.0.0-rc2017-03-27

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/133822?v=4)[Jan Kuchař](/maintainers/jkuchar)[@jkuchar](https://github.com/jkuchar)

---

Top Contributors

[![jkuchar](https://avatars.githubusercontent.com/u/133822?v=4)](https://github.com/jkuchar "jkuchar (122 commits)")[![vhalasu](https://avatars.githubusercontent.com/u/3064686?v=4)](https://github.com/vhalasu "vhalasu (3 commits)")[![dasim](https://avatars.githubusercontent.com/u/375167?v=4)](https://github.com/dasim "dasim (1 commits)")[![jinovak](https://avatars.githubusercontent.com/u/11133173?v=4)](https://github.com/jinovak "jinovak (1 commits)")

### Embed Badge

![Health badge](/badges/jkuchar-filedownloader/health.svg)

```
[![Health](https://phpackages.com/badges/jkuchar-filedownloader/health.svg)](https://phpackages.com/packages/jkuchar-filedownloader)
```

###  Alternatives

[contributte/image-storage

Image storage for Nette framework

28750.5k1](/packages/contributte-image-storage)[jzechy/jquery-fileupload

Nette UploadControl rozšířené o blueimp jQuery FileUpload.

2723.8k](/packages/jzechy-jquery-fileupload)[ublaboo/image-storage

Image storage for Nette framework

2913.9k](/packages/ublaboo-image-storage)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
