Labels

php (35) javascript (31) phpjavascript (30) jquery (23) html (20) mysql (14) database (9) codeigniter (4) json (4) bar chart (2) calendar (2) column chart (2) framework (2) google maps (2) query (2) tables (2) url (2) dropdown (1)

Monday, May 28, 2018

Download file with speed limit using PHP

Here we are explaining about how to limit speed for the file download operation.


<?php
// File form server
$local_file = 'user.php';

// filename that the user gets as default
$download_file = 'myFile.php';

// set the download rate limit (=> 10 kb/s)
$download_rate = 10;

if(file_exists($local_file) && is_file($local_file)) {

    // send headers
    header('Cache-control: private');
    header('Content-Type: application/octet-stream');
    header('Content-Length: '.filesize($local_file));
    header('Content-Disposition: filename='.$download_file);

    // flush content
    flush();

    // open file stream
    $file = fopen($local_file, "r");

    while (!feof($file)) {

        // send the current file part to the browser
        print fread($file, round($download_rate * 10));

        // flush the content to the browser
        flush();

        // sleep one second
        sleep(1);
    }

    // close file stream
    fclose($file);
}
else {
    die('Error: The file '.$local_file.' does not exist!');
}
?>

For more:

Unknown Features
Beautiful Designs
Security Features

41 comments:

  1. Thank for your writting! I have read through some similar topics! However, your post has given me a very special impression, unlike other posts. I hope you continue to have valuable articles like this or more to share with everyone!
    link access to register here:
    duck life 3
    vex 3
    fnaf

    ReplyDelete
  2. This article is very nice.
    If you are facing problems How To Refund In QuickBooks, then you can directly contact QuickBooks Online Support +1-877-249-9444.

    ReplyDelete
  3. Buy Malegra 100mg Online From Trusted online pharmacy Medypharma. Malegra 100mg The drug contains sildenafil citrate. Buy Generic Sildenafil citrate at Lowest Price Online ✅. malegra 100 for sale, malegra 100 pro review. cheap Malegra 100 from your reliable pharmacy.

    ReplyDelete
  4. Buy Malegra 200mg Online belongs to containt of Sildenafil Citrate . Know More about Malegra 200 mg price , uses , How to use , How to take . cheap generic Viagra from this online pharmacy Medypharma, get great discounts and home delivery. Order Now! buy malegra online , cheap malegra 100

    ReplyDelete
  5. Buy Super Kamagra Online is a combination medication consisting of Sildenafil Citrate 100 mg and Dapoxetine Hydrochloride 60 mg. Sildenafil is used to treat erectile dysfunction. Know about super kamagra uses , Price , How to take , Side Effect , How to use .cheap kamagra from Online Trusted Pharmacy Medypharma.

    ReplyDelete
  6. Interesting post! I really amazed to read the great information. You have shared best quality stuff in the content of the post. Thank you so much for such an awesome blog post!

    ReplyDelete
  7. Buy Vidalista Professional Online is an FDA-approved medicine used to treat erectile dysfunction problems in men.Know about vidalista uses , Price , How to take , Side Effect , How to use. vidalista professional 20 review from Trusted Online Pharmacy Medypharma.

    ReplyDelete
  8. Buy Vidalista Professional Online is an FDA-approved medicine used to treat erectile dysfunction problems in men.Know about vidalista uses , Price , How to take , Side Effect , How to use. vidalista professional 20 review from Trusted Online Pharmacy Medypharma.

    ReplyDelete
  9. BuyKamagra Gold 100mg Online is used for Enlarged prostate gland in male, Increased blood pressure in lungs and other conditions. Know about the uses, side effects, price, composition, substitutes, How it works, Lowest Price Online. Kamagra Gold 100mg Online buy with lowest Price Ever Online Pharmacy. Kamagra Gold 100mg Reviews.

    ReplyDelete
  10. I for one feel that you should cotinue in the Bio tech field as it holds immence prospects what with the growing concern for environment.
    seo services

    ReplyDelete
  11. Buy Silagra 100mg Online is used for Penis erection, High blood pressure and other conditions. Silagra 100mgTablet may also be used for purposes not listed in this medication guide. Order Silagra 100mg Online From Trusted Online Pharmacy Medypharma . Best Price In USA.

    ReplyDelete
  12. Buy Tadarise oral Jelly Online is FDA Approved Medication use to Men with erectile dysfunction. Tadarise 20 Oral jelly manufactured by Sunrise Remedies in india. cheap tadalafil oral jelly buy at online trusted pharmacy Medypharma. Tadarise Oral jelly reviews , Lowest Price Online. Order Now !

    ReplyDelete
  13. BuyForzest 20mg Online is used for Enlarged prostate gland in male, Increased blood pressure in lungs and other conditions. Know about the uses, side effects, price, composition, substitutes, How it works, Lowest Price Online. Forzest 20mg Online buy with lowest Price Ever Online Pharmacy. Forzest 20mg Reviews.

    ReplyDelete
  14. Buy Cenforce Professional Online is a fast-acting medication that can last up to four hours. cenforce professional 100mg is manufactured by Centurion Lab. Buy generic drugs from this Trusted online pharmacy Medypharma. Free home delivery on Order above $249 ! cenforce 100mg reviews.

    ReplyDelete
  15. Buy Tenvir 300mg Online is a drug used to treat HIV in combination with other drugs. Tenvir 300 mg price in india manufactured by Cipla Inc, Buy Tenvir 300 mg online from Medypharma - your most dependable online pharmacy. Order Now!

    ReplyDelete
  16. Buy Erlonat 100mg Online is prescribed to patients suffering from metastatic lung cancer which is at a very advanced stage. erlotinib tablets 150 mg price in india, erlonat 150 price, side effects, review

    ReplyDelete
  17. Buy Temonat 250mg Online is used in the treatment of brain tumor. Temozolomide 250 mg Capsule is used to treat specific types of brain cancer, including. Buy Temonat 250 mg from trusted inline Pharmacy Medypharma.

    ReplyDelete
  18. Buy Aromasin 25mg Online Tablet is used in the treatment of early stage breast cancer in postmenopausal women. Know more about Aromasin for sale, price, dosage, cost, steroids, side effects, bodybuilding. Aromasin25 mg pfizer.

    ReplyDelete
  19. Try to find foam sleeping mats for camping. Got mine at Walmart. They are about 1/2" thick, so for some tools, or things that you want really close together, you may want to double it up and not cut all the way through.

    Joe Davies

    ReplyDelete
  20. Buy MyHep 400mg Online is an antiviral medicine used in the treatment of chronic hepatitis C infection. Myhep 400mg price, side effects, dosage, Uses from your most reliable Trusted online pharmacy Medypharma. by your doorsteps, Avail best price in USA.

    ReplyDelete
  21. BuyPPG 0.2mg Online is used to lower blood glucose level in patients with Type 2 Diabetes Mellitus. Buy PPG 0.2 mg side effects, price, Dosage, Uses. PPG Tablets Diabetes. cheap PPG 0.2mg from Medypharma. Order Now.

    ReplyDelete
  22. Buy Fildena Super Active Online This medication is helpful for men that have erection problems. The main ingredient of this brand is Sildenafil Citrate. Sildenafil Citrate acts by improving the performance of enzyme by boosting up the flow of blood into the main organ. Thus, preventing the erection disability and producing.

    ReplyDelete
  23. Buy Fliban 100mg Flibanserin Online Generic Flibanserin (Fliban Tablets) is used to treat decreased sexual desire (Hypoactive Sexual Desire Disorder, Acquired and Generalized) in women who have not gone through menopause and who have never experienced low sexual desire earlier.

    ReplyDelete
  24. I really like your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone to do it for you? Plz reply as I'm looking to construct my own blog and would like to find out where u got this from. thanks a lot Exide battery dealers in Chennai

    ReplyDelete

More Posts

FOLLOW