本文整理汇总了PHP中uploadprogress_get_info函数的典型用法代码示例。如果您正苦于以下问题:PHP uploadprogress_get_info函数的具体用法?PHP uploadprogress_get_info怎么用?PHP uploadprogress_get_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uploadprogress_get_info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: PostMessage
function PostMessage(&$form, $message, &$processed)
{
switch ($message['Event']) {
case 'load':
$more = 0;
$id = $_REQUEST['UPLOAD_IDENTIFIER'];
if ($this->started) {
$progress = uploadprogress_get_info($id);
if (isset($progress)) {
$more = 1;
} else {
$this->uploaded = $this->total;
}
} else {
if ($this->start_time == 0) {
$this->uploaded = $this->total = $this->remaining = $this->average_speed = $this->current_speed = 0;
$this->last_feedback = '';
$this->start_time = time();
}
$progress = uploadprogress_get_info($id);
if (isset($progress)) {
$this->started = 1;
$more = 1;
} elseif (time() - $this->start_time < $this->wait_time) {
$more = 1;
}
}
$message['Actions'] = array();
if (strlen($this->feedback_element)) {
if (isset($progress)) {
$this->uploaded = $progress['bytes_uploaded'];
$this->total = $progress['bytes_total'];
$this->remaining = $progress['est_sec'];
$this->average_speed = $progress['speed_average'];
$this->current_speed = $progress['speed_last'];
}
$feedback = $this->total ? str_replace('{PROGRESS}', intval($this->uploaded * 100.0 / $this->total), str_replace('{ACCURATE_PROGRESS}', $this->uploaded * 100.0 / $this->total, str_replace('{UPLOADED}', $this->FormatNumber($this->uploaded), str_replace('{TOTAL}', $this->FormatNumber($this->total), str_replace('{REMAINING}', $this->FormatTime($this->remaining), str_replace('{AVERAGE_SPEED}', $this->FormatNumber($this->average_speed), str_replace('{CURRENT_SPEED}', $this->FormatNumber($this->current_speed), $this->feedback_format))))))) : '';
if (strcmp($this->last_feedback, $feedback)) {
$message['Actions'][] = array('Action' => 'ReplaceContent', 'Container' => $this->feedback_element, 'Content' => $feedback);
$this->last_feedback = $feedback;
}
}
if ($more) {
$message['Actions'][] = array('Action' => 'Wait', 'Time' => 1);
}
$message['More'] = $more;
break;
}
return $form->ReplyMessage($message, $processed);
}
开发者ID:wycus,项目名称:darmedic,代码行数:50,代码来源:form_upload_progress.php
示例2: dirname
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ProgressBar
*/
use Zend\Loader\StandardAutoloader;
use Zend\ProgressBar\Adapter\JsPull;
use Zend\ProgressBar\ProgressBar;
/**
* This sample file demonstrates a simple use case of a jspull-driven progressbar
*/
if (isset($_GET['uploadId'])) {
require_once dirname(dirname(dirname(__DIR__))) . '/library/Zend/Loader/StandardAutoloader.php';
$loader = new StandardAutoloader(array('autoregister_zf' => true));
$loader->register();
$data = uploadprogress_get_info($_GET['uploadId']);
$bytesTotal = $data === null ? 0 : $data['bytes_total'];
$bytesUploaded = $data === null ? 0 : $data['bytes_uploaded'];
$adapter = new JsPull();
$progressBar = new ProgressBar($adapter, 0, $bytesTotal, 'uploadProgress');
if ($bytesTotal === $bytesUploaded) {
$progressBar->finish();
} else {
$progressBar->update($bytesUploaded);
}
}
?>
<html>
<head>
<title>Zend_ProgressBar Upload Demo</title>
<style type="text/css">
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:31,代码来源:Upload.php
示例3: PMA_getUploadStatus
/**
* Returns upload status.
*
* This is implementation for uploadprogress extension.
*/
function PMA_getUploadStatus($id)
{
global $SESSION_KEY;
global $ID_KEY;
if (trim($id) == "") {
return;
}
if (!array_key_exists($id, $_SESSION[$SESSION_KEY])) {
$_SESSION[$SESSION_KEY][$id] = array('id' => $id, 'finished' => false, 'percent' => 0, 'total' => 0, 'complete' => 0, 'plugin' => $ID_KEY);
}
$ret = $_SESSION[$SESSION_KEY][$id];
if (!PMA_import_uploadprogressCheck() || $ret['finished']) {
return $ret;
}
$status = uploadprogress_get_info($id);
if ($status) {
if ($status['bytes_uploaded'] == $status['bytes_total']) {
$ret['finished'] = true;
} else {
$ret['finished'] = false;
}
$ret['total'] = $status['bytes_total'];
$ret['complete'] = $status['bytes_uploaded'];
if ($ret['total'] > 0) {
$ret['percent'] = $ret['complete'] / $ret['total'] * 100;
}
} else {
$ret = array('id' => $id, 'finished' => true, 'percent' => 100, 'total' => $ret['total'], 'complete' => $ret['total'], 'plugin' => $ID_KEY);
}
$_SESSION[$SESSION_KEY][$id] = $ret;
return $ret;
}
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:37,代码来源:uploadprogress.php
示例4: updateProgress
/**
* This function updates the progress bar
* @param div_id where the progress bar is displayed
* @param upload_id the identifier given in the field UPLOAD_IDENTIFIER
*/
function updateProgress($div_id, $upload_id, $waitAfterupload = false)
{
$objResponse = new XajaxResponse();
$ul_info = uploadprogress_get_info($upload_id);
$percent = intval($ul_info['bytes_uploaded'] * 100 / $ul_info['bytes_total']);
if ($waitAfterupload && $ul_info['est_sec'] < 2) {
$percent = 100;
$objResponse->addAssign($div_id . '_label', 'innerHTML', get_lang('UploadFile') . ' : ' . $percent . ' %');
$objResponse->addAssign($div_id . '_waiter_frame', 'innerHTML', '<img src="' . api_get_path(WEB_CODE_PATH) . 'img/progress_bar.gif" />');
$objResponse->addScript('clearInterval("myUpload.__progress_bar_interval")');
}
$objResponse->addAssign($div_id . '_label', 'innerHTML', get_lang('UploadFile') . ' : ' . $percent . ' %');
$objResponse->addAssign($div_id . '_filled', 'style.width', $percent . '%');
return $objResponse;
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:20,代码来源:upload.xajax.php
示例5: executeFileuploadstatus
public function executeFileuploadstatus($request)
{
$fileid = $request->getParameter('fileid');
if (function_exists("uploadprogress_get_info")) {
$info = uploadprogress_get_info($fileid);
} else {
$info = false;
}
$result = json_encode($info);
$this->getResponse()->addCacheControlHttpHeader('no-cache');
$this->getResponse()->setHttpHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
$this->getResponse()->setHttpHeader('Content-type', 'application/json');
$this->getResponse()->setHttpHeader("X-JSON", $result);
return sfView::HEADER_ONLY;
}
开发者ID:EQ4,项目名称:smint,代码行数:15,代码来源:actions.class.php
示例6: get
function get()
{
$this->sessionState(0);
// turn off the session..
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
if (!function_exists('uploadprogress_get_info')) {
$this->jok(false);
}
if (!empty($_GET['id'])) {
// var_dump(uploadprogress_get_info($_GET['id']));
$ret = uploadprogress_get_info($_GET['id']);
$this->jok($ret);
}
$this->jerr("no data");
}
开发者ID:roojs,项目名称:Pman.Core,代码行数:16,代码来源:UploadProgress.php
示例7: compose
function compose($o)
{
if ($this->get->id) {
$this->expires = 'onmaxage';
Patchwork::setPrivate();
if (function_exists('upload_progress_meter_get_info')) {
$o = (object) @upload_progress_meter_get_info($this->get->id);
} else {
if (function_exists('uploadprogress_get_info')) {
$o = (object) @uploadprogress_get_info($this->get->id);
}
}
} else {
$this->maxage = -1;
}
return $o;
}
开发者ID:nicolas-grekas,项目名称:Patchwork,代码行数:17,代码来源:upload.php
示例8: getUploadProgress
/**
* @param string $id
* @return array|bool
* @throws Exception\PhpEnvironmentException
*/
protected function getUploadProgress($id)
{
if (!$this->isUploadProgressAvailable()) {
throw new Exception\PhpEnvironmentException('UploadProgress extension is not installed');
}
$uploadInfo = uploadprogress_get_info($id);
if (!is_array($uploadInfo)) {
return false;
}
$status = array('total' => 0, 'current' => 0, 'rate' => 0, 'message' => '', 'done' => false);
$status = $uploadInfo + $status;
$status['total'] = $status['bytes_total'];
$status['current'] = $status['bytes_uploaded'];
$status['rate'] = $status['speed_average'];
if ($status['total'] == $status['current']) {
$status['done'] = true;
}
return $status;
}
开发者ID:idwsdta,项目名称:INIT-frame,代码行数:24,代码来源:UploadProgress.php
示例9: progress
/**
* Returns the progress status for a file upload process.
*
* @param string $key
* The unique key for this upload process.
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
* A JsonResponse object.
*/
public function progress($key)
{
$progress = array('message' => t('Starting upload...'), 'percentage' => -1);
$implementation = file_progress_implementation();
if ($implementation == 'uploadprogress') {
$status = uploadprogress_get_info($key);
if (isset($status['bytes_uploaded']) && !empty($status['bytes_total'])) {
$progress['message'] = t('Uploading... (@current of @total)', array('@current' => format_size($status['bytes_uploaded']), '@total' => format_size($status['bytes_total'])));
$progress['percentage'] = round(100 * $status['bytes_uploaded'] / $status['bytes_total']);
}
} elseif ($implementation == 'apc') {
$status = apc_fetch('upload_' . $key);
if (isset($status['current']) && !empty($status['total'])) {
$progress['message'] = t('Uploading... (@current of @total)', array('@current' => format_size($status['current']), '@total' => format_size($status['total'])));
$progress['percentage'] = round(100 * $status['current'] / $status['total']);
}
}
return new JsonResponse($progress);
}
开发者ID:neetumorwani,项目名称:blogging,代码行数:28,代码来源:FileWidgetAjaxController.php
示例10: getStatus
/**
* Get the status of all uploads passed in
*/
function getStatus($ids)
{
$ret = array();
foreach ($ids as $id => $upId) {
$ret[$id] = new stdClass();
if (!function_exists('uploadprogress_get_info')) {
$ret[$id]->message = "Uppladdning YYpågår";
$ret[$id]->percent = "10";
$ret[$id]->noStatus = true;
return $ret;
}
$tmp = uploadprogress_get_info($upId);
if (!is_array($tmp)) {
sleep(1);
$tmp = uploadprogress_get_info($upId);
if (!is_array($tmp)) {
$ret[$id]->message = "Uppladdning klar";
$ret[$id]->percent = "100";
return $ret;
}
}
if ($tmp['bytes_total'] < 1) {
$percent = 100;
} else {
$percent = round($tmp['bytes_uploaded'] / $tmp['bytes_total'] * 100, 2);
}
if ($percent == 100) {
$ret[$id]->message = "Klar!";
}
$eta = sprintf("%02d:%02d", $tmp['est_sec'] / 60, $tmp['est_sec'] % 60);
$speed = $this->_formatBytes($tmp['speed_average']);
$current = $this->_formatBytes($tmp['bytes_uploaded']);
$total = $this->_formatBytes($tmp['bytes_total']);
$ret[$id]->message = "{$eta} kvar (@ {$speed}/sec)\t{$current}/{$total} ({$percent}%)";
$ret[$id]->percent = $percent;
}
return $ret;
}
开发者ID:krillo,项目名称:motiomera,代码行数:41,代码来源:UploadProgressMeterStatus.class.php
示例11: uploadprogress_get_info
<?php
//single upload progress meter
//http://www.ultramegatech.com/blog/2010/10/create-an-upload-progress-bar-with-php-and-jquery/
include '../../include/db.php';
// Fetch the upload progress data
$status = uploadprogress_get_info(getval('uid', 'test'));
if ($status) {
// Calculate the current percentage
echo round($status['bytes_uploaded'] / $status['bytes_total'] * 100);
} else {
// If there is no data, assume it's done
echo 100;
}
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:14,代码来源:get_progress.php
示例12: upload_progress
/**
* File upload progress handler.
*/
public function upload_progress()
{
$params = array('action' => $this->action, 'name' => rcube_utils::get_input_value('_progress', rcube_utils::INPUT_GET));
if (function_exists('uploadprogress_get_info')) {
$status = uploadprogress_get_info($params['name']);
if (!empty($status)) {
$params['current'] = $status['bytes_uploaded'];
$params['total'] = $status['bytes_total'];
}
}
if (!isset($status) && filter_var(ini_get('apc.rfc1867'), FILTER_VALIDATE_BOOLEAN) && ini_get('apc.rfc1867_name')) {
$prefix = ini_get('apc.rfc1867_prefix');
$status = apc_fetch($prefix . $params['name']);
if (!empty($status)) {
$params['current'] = $status['current'];
$params['total'] = $status['total'];
}
}
if (!isset($status) && filter_var(ini_get('session.upload_progress.enabled'), FILTER_VALIDATE_BOOLEAN) && ini_get('session.upload_progress.name')) {
$key = ini_get('session.upload_progress.prefix') . $params['name'];
$params['total'] = $_SESSION[$key]['content_length'];
$params['current'] = $_SESSION[$key]['bytes_processed'];
}
if (!empty($params['total'])) {
$params['percent'] = round($status['current'] / $status['total'] * 100);
$params['text'] = $this->gettext(array('name' => 'uploadprogress', 'vars' => array('percent' => $params['percent'] . '%', 'current' => $this->show_bytes($params['current']), 'total' => $this->show_bytes($params['total']))));
}
$this->output->command('upload_progress_update', $params);
$this->output->send();
}
开发者ID:alecchisi,项目名称:roundcubemail,代码行数:33,代码来源:rcmail.php
示例13: implode
$nameAttachment = implode('.', array_slice(explode('.', $attachment), 1));
$attachment = 'uploads/temporary/' . $attachment;
$mailer->AddAttachment($attachment, $nameAttachment);
}
}
if (!$mailer->sendEmail($_POST['email'], false, false, $sendto, false, $_POST['subject'], $mailTemplate, $mailText)) {
echo 'errSend';
} else {
!empty($_POST['attachment']) ? filesys::removeFiles($_POST['attachment']) : null;
echo 'success';
}
}
} elseif (isset($_GET['uploadFile'])) {
// обработка запроса о процессе загрузки файла (Если php поддерживает функцию uploadFileProgress)
if (isset($_GET['action']) && 'uploadFileProgress' === $_GET['action'] && !empty($_POST['file']) && !empty($_POST['key'])) {
echo !function_exists('uploadprogress_get_info') || !($result = uploadprogress_get_info($_POST['key'])) ? ajax::sdgJSONencode(array('result' => 0, 'size' => file_exists($_POST['file']) ? filesize($_POST['file']) : 0)) : ajax::sdgJSONencode($result + array('result' => 1));
} elseif (isset($_GET['action']) && 'delUploaded' === $_GET['action'] && !empty($_POST['delUploadedFile'])) {
foreach (array_unique(explode(',', $_POST['delUploadedFile'])) as $file) {
@unlink('uploads/temporary/' . $file);
}
echo 'success';
} elseif (isset($_POST['inputName']) && is_string($_POST['inputName']) && ($inputName =& $_POST['inputName']) && !empty($_FILES[$inputName])) {
// проверяем ошибки
switch ($_FILES[$inputName]['error']) {
// системная ошибка: Превышен максимально разрешенный размер файла
case 1:
case 2:
$_FILES[$inputName]['error'] = 'errFileMaxSize';
break;
// системная ошибка: Не удалось загрузить файл
// системная ошибка: Не удалось загрузить файл
开发者ID:innova-market,项目名称:JobExpert,代码行数:31,代码来源:ajax.php
示例14: page
/* DISABLE_PHP_LINT_CHECKING */
##|+PRIV
##|*IDENT=page-upload_progress
##|*NAME=System: Firmware: Manual Update page (progress bar)
##|*DESCR=Allow access to the 'System: Firmware: Manual Update: Progress bar' page.
##|*MATCH=upload_progress*
##|-PRIV
include "guiconfig.inc";
// sanitize the ID value
$id = $_SESSION['uploadid'];
if (!$id) {
echo gettext("Sorry, we could not find an uploadid code.");
exit;
}
// retrieve the upload data from APC
$info = uploadprogress_get_info($id);
// false is returned if the data isn't found
if (!$info) {
echo <<<EOF
\t<html>
\t\t<meta http-equiv="Refresh" CONTENT="1; url=upload_progress.php?uploadid={$id}">
\t\t<body>
\t\t\t<?php printf(gettext("Could not locate progress %s. Trying again..."),{$id});?>
\t\t</body>
\t</html>
EOF;
exit;
}
if ($info['bytes_uploaded'] >= $info['bytes_total']) {
echo <<<EOF1
\t<html>
开发者ID:rdmenezes,项目名称:pfsense,代码行数:31,代码来源:upload_progress.php
示例15: extract
<?php
/*
demo page and servlet for jquery.uploadprogress
requires PHP 5.2.x
with uploadprogress module installed:
http://pecl.php.net/package/uploadprogress
*/
extract($_REQUEST);
var_dump($_REQUEST);
// servlet that handles uploadprogress requests:
if ($upload_id) {
$data = uploadprogress_get_info($upload_id);
if (!$data) {
$data['error'] = 'upload id not found';
} else {
$avg_kb = $data['speed_average'] / 1024;
if ($avg_kb < 100) {
$avg_kb = round($avg_kb, 1);
} else {
if ($avg_kb < 10) {
$avg_kb = round($avg_kb, 2);
} else {
$avg_kb = round($avg_kb);
}
}
// two custom server calculations added to return data object:
$data['kb_average'] = $avg_kb;
$data['kb_uploaded'] = round($data['bytes_uploaded'] / 1024);
}
echo json_encode($data);
开发者ID:houzhenggang,项目名称:mailer,代码行数:31,代码来源:jquery-uploadprogress-demo-simple.php
示例16: uploadprogress_get_info
<?php
$data = null;
if (isset($_GET['upload_key'])) {
$data = uploadprogress_get_info($_GET['upload_key']);
if (!$data) {
sleep(1);
$data = uploadprogress_get_info($_GET['upload_key']);
}
}
echo json_encode($data);
开发者ID:Chipusy,项目名称:lkbroker,代码行数:11,代码来源:uploadstatus.php
示例17: getProgress
function getProgress($uploadId)
{
$progress = uploadprogress_get_info($uploadId);
return !is_array($progress) ? null : array('total' => $progress['bytes_total'], 'current' => $progress['bytes_uploaded']);
}
开发者ID:nahuelange,项目名称:FileZ,代码行数:5,代码来源:ProgressUpload.php
示例18: Copyright
<?php
/*
This file is part of the Filebin package.
Copyright (c) 2003-2009, Stephen Olesen
All rights reserved.
More information is available at http://filebin.ca/
*/
require "filebin.inc.php";
if (!isset($_GET["dl"])) {
exit;
}
$p = uploadprogress_get_info($_GET["dl"]);
if (empty($p)) {
header("Content-Type: text/javascript");
$sth = getDB()->prepare("SELECT error,error_message FROM upload_tracking WHERE upload_id=? ORDER BY created DESC LIMIT 1");
$sth->execute(array($_GET["dl"]));
$row = $sth->fetch(PDO::FETCH_ASSOC);
$sth = null;
if ($row['error']) {
print 'location.href = "http://filebin.ca/error.php?id=' . $_GET['dl'] . '";';
exit;
}
$f = new File();
$f->byUploadID($_GET["dl"]);
if ($f->valid) {
print 'location.href = "http://filebin.ca/complete.php?id=' . $_GET['dl'] . '";';
} else {
print 'if(canForward || requestCount++ > 7) { location.href = "http://filebin.ca/complete.php?id=' . $_GET['dl'] . '"; }';
}
exit;
开发者ID:slepp,项目名称:filebin.ca,代码行数:31,代码来源:ajax.php
示例19: header
<?php
header("Pramga: no-cache");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Thur, 25 May 1988 14:00:00 GMT");
$status = false;
// APC upload progress is enabled:
if ((bool) ini_get('apc.rfc1867')) {
$status = apc_fetch(ini_get('apc.rfc1867_prefix') . $_GET['for']);
$status = array('bytes_uploaded' => (int) $status['current'], 'bytes_total' => (int) $status['total']);
} else {
if (function_exists('uploadprogress_get_info')) {
$status = uploadprogress_get_info($_GET['for']);
$status = array('bytes_uploaded' => (int) $status['bytes_uploaded'], 'bytes_total' => (int) $status['bytes_total']);
}
}
$status['bytes_uploaded'] = max($status['bytes_uploaded'], 0);
$status['bytes_total'] = max($status['bytes_total'], 1);
if (!headers_sent()) {
header('content-type: text/json');
echo json_encode($status);
}
开发者ID:symphonycms,项目名称:symphony-3,代码行数:22,代码来源:status.php
示例20: sprintf
}
if ($bytes < 900000) {
return sprintf("%dKB", $bytes / 1000);
}
return sprintf("%.2fMB", $bytes / 1000 / 1000);
}
$data = array('status' => 0, 'msg' => '', 'progress' => 0, 'time' => '', 'size' => '');
if (isset($_POST['upload_id'])) {
$filter = new VFilter();
$upload_id = $filter->get('upload_id');
if (!$upload_id) {
$data['msg'] = 'Upload is not a valid upload!';
} else {
$progress = NULL;
if (function_exists('uploadprogress_get_info')) {
$progress = uploadprogress_get_info($upload_id);
$data['status'] = 1;
} elseif (function_exists('upload_progress_meter_get_info')) {
$progress = upload_progress_meter_get_info($upload_id);
$data['status'] = 1;
} else {
$data['status'] = 3;
}
if ($progress) {
$meter = sprintf("%.2f", $progress['bytes_uploaded'] / $progress['bytes_total'] * 100);
$speed_last = $progress['speed_last'];
$speed = $speed_last < 10000 ? sprintf("%.2f", $speed_last / 1000) : sprintf("%d", $speed_last / 1000);
$eta = sprintf("%02d:%02d", $progress['est_sec'] / 60, $progress['est_sec'] % 60);
$uploaded = format_size($progress['bytes_uploaded']);
$total = format_size($progress['bytes_total']);
$data['progress'] = $meter;
开发者ID:ecr007,项目名称:pr0n,代码行数:31,代码来源:upload_progress.php
注:本文中的uploadprogress_get_info函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论