Ejemplo n.º 1
0
            header(sprintf('content-range:bytes %s-%s/%s', $offer_star, $offer_end, $file_size));
            // fp指针跳到断点位置
            fseek($fp, sprintf('%u', $offer_star));
            $read_bin = null;
            if (!feof($fp)) {
                $read_bin = fread($fp, round($offer_star, 0));
                ob_flush();
                flush();
                //sleep(1); // 用于测试,减慢下载速度
            }
            $param['token'] = $token;
            $param['filename'] = $filename;
            $param['offerstar'] = $offer_star;
            $param['bin'] = $read_bin;
            $uploadParam = new \proto\UploadParam($param);
            $upload_ret = $client->uploadFile($uploadParam);
            print "<br />********************<br />";
            var_dump($upload_ret);
            print "<br />********************<br />";
        } catch (Exception $e) {
            print $e;
        } finally {
            $fp != null && fclose($fp);
        }
    }
    $transport->close();
} catch (TException $tx) {
    print 'TException: ' . $tx->getMessage() . "\n";
}
?>