Is there a to limit the speed a user can download a file? Preferably I would like to set different limits based on a user role, "premium" users would have faster download speeds. Can someone help point me in the right direction, I have searched but not found a solution.

Comments

bojanz’s picture

Category: Feature request » Support request
Status: Active » Fixed

The actual transferring of the downloaded file is done from file/%file/download (the callback provided by Commerce File or File Entity if installed).
Both use file_transfer(), which freads() the file piece by piece.
You would need to override that url via hook_menu_alter(), then call your own copy of file_transfer() that does a sleep() after every fread().

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.