<body> <div class="prompt"></div> <?php $this->load->view('public/page_header'); ?> <div class="content"> <!-- 上传文件 --> <div class="fn-choice" id="fn-choice"> <button class="active" id="upolad-files">上传文件</button> <button id="base-choose">我的文库</button> <span class="color-block"></span> </div> <article class="file-content" id="file-content"> <?php $cart = new MY_Cart(); $items = $cart->getItems(); ?> <a class="container-upload" id="container-upload" href="javascript:void(0)" data-num='<?php echo count($items); ?> '>上传文件 <!-- <input class="upload" type="file" id="file-upload" multiple accept="application/msword,image/jpeg,image/png,application/vnd.ms-powerpoint,,application/nd.ms-works,application/vnd.ms-excel" /> --> </a> <!-- <a id="uploadfiles" href="javascript:;">[Upload files]</a> --> </article> <article class="choose-base" id="choose-base"> <section class="searchBtn"><input type="text" class="code" placeholder="输入文库编码"> <button class="apply">申请加入</button></section>
public function getProgress() { header('Content-Type: text/event-stream'); header('Cache-Control: no-cache'); header('Connection: keep-alive'); $cart = new MY_Cart(); $items = $cart->getItems(); $num = count($items); $bmobObj = new BmobObject('File_Info'); while ($num > 0) { foreach ($items as &$item) { $fileMD5 = $item->fileMD5; $res = $bmobObj->get('', array('where={"fileMD5":"' . $fileMD5 . '"}', 'limit=1')); if (count($res->results) == 1) { $num--; } } $this->sendSSEMsg($num); if ($num > 0) { $num = count($items); } } $this->sendSSEMsg($num); }