public static function readPartialFile($file, $from = 0, $to = 0, $filesize = FALSE, $force = FALSE, $context = NULL) {
        if(!$force) {
            if(!@file_exists($file)) {
                return 404;
            }

            if(!@is_readable($file)) {
                return 403;
            }
        }

        //open file
        if(!($file instanceof SplFileObject)) {
            $file = new SplFileObject($file);
        }

        //get filesize
        $filesize = $file->getSize();

        if(is_array($from)) {
            throw new Exception("Not implemented yet.");
        }

        if($from < 0) {
            $from = $filesize + $from;
        }

        if($to <= 0) {
            $to = $filesize + $to - 1;
        }

        if($from < 0 || $to >= $filesize || $from > $to) {
            throw new Exception("Invalid Range. (filesize: $filesize, from: $from, to: $to)");
        }

        $file->fseek($from);

        $length = $to - $from + 1;

        while($length) {
            $read = ($length > 8192) ? 8192 : $length;
            $length -= $read;
            $content = $file->fread($read);
            if($content === FALSE) {
                return FALSE;
            }
            else {
                print($content);
            }
        }

        return $length;
    }