Jump to content

e-th0mas

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

e-th0mas's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Anyone? Sorry for the bump, but still looking for an answer...
  2. I looked into that, but I couldn't figure out how to limit the download speed using those functions.
  3. When using the code in my first post it downloads around 8KB/s. When I comment out sleep(1); it downloads at full speed, as it normally would when I download it directly myself. However by doing this I can't limit the download speed anymore... are there any alternative ways to achieve this? Thanks
  4. Hi all, I'm trying to make a PHP script that downloads a file off a remote FTP server and serves the file to the visitor with a limited download speed. Right now I'm using fopen like this: $path = "ftp://".$username.":".$password."@".$server."/"; $fullPath = ($path.$fileName); $speed = 400; // 400 kb/s download rate header("Cache-control: private"); header("Content-Type: application/octet-stream"); //header("Content-Length: ".filesize($fullPath)); header("Content-Disposition: filename=\"".$fileName."\""); flush(); $fd = fopen($fullPath, "r"); while(!feof($fd)) { echo fread($fd, round($speed*1024)); flush(); sleep(1); } fclose ($fd); The file does download but with the wrong speed (8kb/s), does anyone know why? When I run the same code with a local file instead of a file on FTP it works fine and downloads at the speed I set it to.. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.