Limit File Download Speed (Using PHP)

Yes, using simple PHP snippet you can limit the download speed of a file. This can be done for Bandwidth throttling or for Rate limiting. One practical application of this script will be slowing down the speed at which someone can download a file for free. If you pay for the service then the speed would be either unlimited or less restrictive.
Another application would be if you are generating the file as it is being created. Like, If there is a 10mb lossless image, and you know that it takes at most 1 second to create 256kb of it, then you can set the script to stream 256kb every second. This way the user can start receiving data as soon as the first 256kb are ready.
{code type=php}
// The file that will be sent to the user
$your_file = ‘’;

// Rename the file name
$new_file = ‘’;

// Set the download speed limit (70 kb/s)
$download_speed = 70;

if(file_exists($myl_file) && is_file($my_file)) {

// Headers
header(‘Cache-control: private’);
header(‘Content-Type: application/octet-stream’);
header(‘Content-Length: ‘.filesize($my_file));
header(‘Content-Disposition: filename=’.$new_file);

// Flush the content

// File stream
$file = fopen($my_file, “r”);

while (!feof($file)) {

// Send the current part of the file to the browser
echo fread($file, round($download_speed* 1024));

// Flush the content to the browser

// Sleep one second

// Close file stream

else {
die(‘Error: The file ‘.$my_file.’ does not exist!’);
This script can be used to limit the download speed at which one can download the file. You can also try out QoS Bandwidth Throttle in PHP.

Filling a Glass with Water (Using CSS3)

HTML5 is amazing and list of things which can be done using it is endless. Anyways, I am sharing how we can fill an empty glass with water using HTML5, I am sharing the code snippets for it. Let me know your thoughts on it. A modern web browser(Like Firefox, Chrome, Opera, Safari) will be needed for it. The live demonstration of this can be seen at the end of this post.


The HTML is really simple, it has three divs, first for container of the glass, second for the glass and the third for the water in it. The first div(container) is not really necessary.
{code type=HTML}



This is where it gets a little tricky, the #container has the general styling properties for the container, the #glass again has general CSS properties of the glass. Now in #water, a background image has been used for waves for the water, you can also specify a color instead of the background image if you don’t need the waves. Then comes the transition CSS properties, transition tags are used here for the easing effect after the hover action(when the water has to fall down). Then finally #glass:hover #water comes which defines the CSS properties when the user hovers over the element, transition properties are the CSS tags responsible for these easing effects.
{code type=CSS}
#container {
background: rgba( 0, 0, 0, 0.10);
width: 300px;
border-left: 1px solid #bbb;
border-right: 1px solid #bbb;
border-bottom: 1px solid #bbb;
border-top: 1px solid #ccc;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding-left: 5px;
padding-right: 5px;
padding-bottom: 30px;
padding-top: 5px;
#glass {
background: rgba( 255, 255, 255, 0.50);
border: 1px solid #bbb;
border-top: 1px solid #eee;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
width: 300px;
height: 400px;
position: relative;
#water {
background-image: url(“waves.png”);
background-position: top right;
position: absolute;
bottom: 0px;
width: 300px;
height: 100px;
-webkit-transition: all 3s ease-out;
-moz-transition: all 3s ease-out;
-o-transition: all 3s ease-out;
transition: all 3s ease-out;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
#glass:hover #water {
height: 350px;
background-position: top left;
-webkit-transition: all 3s ease-out;
-moz-transition: all 3s ease-out;
-o-transition: all 3s ease-out;
transition: all 3s ease-out;


Here is a demonstration below for filling a glass with water, alternatively you can click here.

Or if you don’t like the waves(Or click here).

Further Reading

Below are the pages of CSS properties used in above snippets.

6 Websites for Animated AJAX Loading GIF Images

Lately I was making a template which had a working AJAX Contact Form, at first I struggled a little for the loading image, but then I realized there are couple of websites where we can actually get(and generate) amazing loading GIF images easily according to our specifications, most of these sites also provide a wide range of images to chose from. Thus I am sharing some of those websites, hope this is helpful.   Free AJAX animated loading gif s   3 dimensional  3D

Ajaxload   Ajax loading gif generator


Chimply generates your images

Web Script Lab

Web Script Lab » Ajax Loading Gif Generator

Load Info

Load Info   gif generator

AJAX Activity indicators

AJAX Activity indicators   Animated GIFs designed to indicate your site is doing something

Immaculate Portfolio Template v1.0 Now Available

I have made another free template “Immaculate”. This one is a single page website template, with smooth scrolling, has 6 skins included in it, working ajax contact form, useful shortcodes and a lot more. This one also uses HTML5 and CSS3 and is fast loading while being cross browser compatible. You should definitely head over to its release page at

You are free(And recommended ;-)) to share and use it. You are free to use it for your personal as well as commercial projects as it is released under New BSD License. If you have any issues related to it, you can contact me via the contact form at

Here is a small preview of one of the skin of the template, go to the Release Page for full details.
You can see the live preview here and download it from here.