PHP Resumable Download Server
I wanted to add a download section to my site, but at the same time keep statistics of the files downloaded. So made a little PHP script to act as a download server.
This little script became a little larger when I added support for partial file downloads. I noticed that many comments in the PHP manual and other sources described the method wrong. For instance, many of them announced to accept multiple byte ranges while that was not the fact. And they also tended to not handle the requested byte range according to the HTTP 1.1 specifications.
Now, I'm never pretending this is a complete implementation or free for issues. But it should work very well and I've tried to make it behave to the specifications.
Features
- Serves files from a file repository.
- Makes sure no files outside the repository is served.
- Lists files if a directory is requested.
- Supports partial file request allowing users to pause or accelerate downloads.
- Logging function to keep statistic over the file downloads. (Needs configuring to work.)
Known Issues
- Files larger than 2GB might give unexpected results on platforms that use 32-bit integers. This is because it might affect the calculation of filesizes.
Download
Installation instructions is in the readme.txt file.
Comments
-
On 21.05.08 03:12 GMT Shamus said:
Hi. There is no settings.ini file in the package, as referenced in step 1 of your readme.txt file. Please advise how to access this file. -
On 27.05.08 19:08 GMT Thomas Thomassen said:
My apologies Shamus. The reference to "settings.ini" in the readme.txt is suppose to be "server.ini".
Thanks for pointing that out. -
On 12.02.09 10:34 GMT Thangaraj said:
Great script!
Worked well for me. I used the partial download feature into one of our file serving scripts.
Thank you :) -
On 12.02.09 17:26 GMT Thangaraj said:
Great script!
Worked well for me. I used the partial download feature into one of our file serving scripts.
Thank you :) -
On 13.03.09 07:21 GMT shabi said:
i want to find php server so i get it from this web. -
On 19.06.09 12:53 GMT Stuffs said:
line: 152
// workaround for IE filename bug with multiple periods / multiple dots in filename
// that adds square brackets to filename - eg. setup.abc.exe becomes setup[1].abc.exe
$iefilename = preg_replace('/./', '%2e', $basename, substr_count($basename, '.') - 1);
----------
$iefilename =
should be read
$basename =
Else your IE fix is not going to be passed once it it outside that section that fixes it. -
On 22.06.09 22:30 GMT Thomas Thomassen said:
Thanks Stuffs!
Archived Posts:
Subscribe to this Blog:
Labels:
- accessibility
- animation
- background-image
- barcelona
- career
- changelog
- christmas
- code
- colour
- com
- css
- deardiary
- del
- desktopx
- documentation
- dom
- england
- events
- film
- fun
- gadget
- games
- gestures
- halloween
- html
- ie
- innerhtml
- ins
- javacript
- keyboard
- life
- list-style-image
- lists
- london
- modelmaking
- moving
- msn
- paintball
- php
- pingback
- pixar
- printer
- product
- scanner
- scheme
- scripting
- semantic
- server
- sidebar
- skype
- snow
- software
- split()
- test
- travel
- underground
- userinterface
- vista
- voip
- w3c
- webdesign
- website
- whitespace
