Paste serve_file_resumable from DaveRandom from http://stackoverflow.com/a/4451376