<?php

require_once "phpuploader/include_phpuploader.php";
$uploader = new PhpUploader();
if (@$_GET["download"]) {
    /*
        $fileguid=$_GET["download"];
    	$mvcfile=$uploader->GetUploadedFile($fileguid);*/
    $filepath = $_GET["download"];
    $filename = $_GET["name"];
    switch (pathinfo($filename, PATHINFO_EXTENSION)) {
        case 'pdf':
            header("Content-type: application/pdf");
            header("Content-Disposition: inline; filename=\"" . $filename . "\"");
            break;
        default:
            header("Content-Type: application/oct-stream");
            header("Content-Disposition: attachment; filename=\"" . $filename . "\"");
            break;
    }
    @readfile($filepath);
}
if (@$_POST["delete"]) {
    /*
        $fileguid=$_POST["delete"];
    	$mvcfile=$uploader->GetUploadedFile($fileguid); */
    $filepath = $_POST["delete"];
    unlink($filepath);
    echo "OK";
}
if (@$_POST["guidlist"]) {
<?php

require_once "phpuploader/include_phpuploader.php";
?>
    
<?php 
$uploader = new PhpUploader();
$mvcfile = $uploader->GetValidatingFile();
if ($mvcfile->FileName == "accord.bmp") {
    $uploader->WriteValidationError("My custom error : Invalid file name. ");
    exit(200);
}
//USER CODE:
$productId = $_REQUEST["proId"];
$imageType = $_REQUEST["imgType"];
$savefilepath = "data/" . $productId . "_" . $imageType . "." . substr(strrchr($mvcfile->FileName, '.'), 1);
$targetfilepath = "../../" . $savefilepath;
if (is_file($targetfilepath)) {
    unlink($targetfilepath);
}
$mvcfile->MoveTo($targetfilepath);
$uploader->WriteValidationOK();
require_once "../../controller/ProductImageController.php";
ProductImageController::Update($productId, $imageType, $savefilepath);
?>
   
<?php

require_once "include_phpuploader.php";
require_once "smart_resize_image.function.php";
set_time_limit(3600);
$uploader = new PhpUploader();
$uploader->PreProcessRequest();
$mvcfile = $uploader->GetValidatingFile();
if ($mvcfile->FileName == "thisisanotvalidfile") {
    $uploader->WriteValidationError("My custom error : Invalid file name. ");
    exit(200);
}
if ($uploader->SaveDirectory) {
    if (!$uploader->AllowedFileExtensions) {
        $uploader->WriteValidationError("When using SaveDirectory property, you must specify AllowedFileExtensions for security purpose.");
        exit(200);
    }
    $cwd = getcwd();
    chdir(dirname($uploader->_SourceFileName));
    if (!is_dir($uploader->SaveDirectory)) {
        $uploader->WriteValidationError("Invalid SaveDirectory ! not exists.");
        exit(200);
    }
    chdir($uploader->SaveDirectory);
    $wd = getcwd();
    chdir($cwd);
    $targetfilepath = "../uploads/" . $mvcfile->FileName;
    if (file_exists($targetfilepath)) {
        unlink($targetfilepath);
    }
    $mvcfile->CopyTo($targetfilepath);
Exemple #4
0
<?php 
require_once "phpuploader/include_phpuploader.php";
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Demo 1 - use SaveDirectory property</title>
</head>
<body>
	<div>
	
<hr/>
	
	<?php 
$uploader = new PhpUploader();
$uploader->MultipleFilesUpload = true;
$uploader->InsertText = "Select multiple files (Max 1000M)";
$uploader->MaxSizeKB = 1024000;
$uploader->AllowedFileExtensions = "*.xls,*.xlsx,*.csv,*.bmp,*.txt,*.zip,*.rar";
$uploader->SaveDirectory = "savefiles";
$uploader->FlashUploadMode = "Partial";
$uploader->Render();
?>
	
	</div>
		
	<script type='text/javascript'>
	function CuteWebUI_AjaxUploader_OnTaskComplete(task)
	{
		var div=document.createElement("DIV");
Exemple #5
0
function callOut_HTML($sDirLocalPlantillas)
{
    $smarty = new Smarty();
    $response = array();
    global $arrConf;
    $oMainConsole = new getInfoMainConsole();
    $oMainConsole->callcenter_db_connect($arrConf['cadena_dsn']);
    $sThemeDir = "modules/agent_console/themes/default";
    $sAgent = $_SESSION['callcenter']['extension'];
    $number = getParameter('number');
    //var_dump($number);
    $agentid = $oMainConsole->getAgentId($sAgent);
    if (trim($number) !== '') {
        $mobileHistory = $oMainConsole->getCallMobileHistoryArray($number, 10);
        $callHistory = $oMainConsole->getCallHistoryArray(50, $sAgent);
        $externalNote = $oMainConsole->getExternalNote($number);
        $customerInfo = $oMainConsole->getCustomerInfo($number);
        if (is_null($customerInfo)) {
            $customerInfo['lastname'] = '(không biết)';
            $customerInfo['firstname'] = '';
        }
        $callid = $infoLlamada['call_id'];
        $delivery = $oMainConsole->getDelivery($number, false);
        $response['event'] = "agentlinked";
        $response['txt_estado_agente_inicial'] = "Kết nối cuộc gọi ra ngoài";
        $response['class_estado_agente_inicial'] = "elastix-callcenter-class-estado-activo";
    } else {
        $mobileHistory = null;
        $callHistory = $oMainConsole->getCallHistoryArray(50, $sAgent);
        $customerInfo = null;
        $externalNote = null;
        $callid = null;
        $delivery = null;
        $response['event'] = "agentunlinked";
        $response['txt_estado_agente_inicial'] = "Không có cuộc gọi";
        $response['class_estado_agente_inicial'] = "elastix-callcenter-class-estado-ocioso";
    }
    //close mysql
    $oMainConsole->callcenter_db_disconnect();
    // phpuploader
    $uploader = new PhpUploader();
    $uploader->MultipleFilesUpload = true;
    $uploader->InsertText = "Chọn vé đính kèm (Dung lượng < 10M)";
    $uploader->MaxSizeKB = 10240;
    $uploader->Name = "myuploader";
    $uploader->AllowedFileExtensions = "*.jpg,*.png,*.gif,*.bmp,*.pdf,*.xls,*.doc,*.xlsx,*.docx";
    //$uploader->UploadUrl="/modules/agent_console/upload.php";
    $html_uploader = $uploader->Render();
    // end of phpuploader
    $smarty->assign(array('MOBILE_HISTORY' => $mobileHistory, 'CALL_HISTORY' => $callHistory, 'CUSTOMER_NUMBER' => $number, 'THEME_PATH' => $sThemeDir, 'AGENTLINKED' => '0', 'CUSTOMER_INFO' => $customerInfo, 'CALL_ID' => $callid, 'AGENT_ID' => $agentid, 'CALL_DELIVERY' => $delivery, 'UPLOADER' => $html_uploader, 'OUTGOING' => 'yes', 'EXTERNAL_NOTE' => $externalNote));
    $html = $smarty->fetch("{$sDirLocalPlantillas}/hnh_agent_console.tpl");
    //process json data and return
    $response['callid'] = null;
    $response['calltype'] = "outgoing";
    $response['campaign_id'] = 3;
    $response['cronometro'] = "00:00:00";
    $response['llamada_informacion'] = $html;
    $response['timer_seconds'] = null;
    $response['txt_contacto_telefono'] = $number;
    $response['url'] = null;
    $response['urlopentype'] = null;
    $object[] = $response;
    $json = new Services_JSON();
    Header('Content-Type: application/json');
    return $json->encode($object);
}
			alert("Please browse files for upload");
		}
	}
	</script>
	
</head>
<body>
	<div class="demo">     
			<h2>Start uploading manually</h2>
			<p>This sample demonstrates how to start uploading manually after file selection vs automatically.</p>
			<P>Allowed file types: <span style="color:red">jpg, gif, txt, png, zip</span></p>

			<!-- do not need enctype="multipart/form-data" -->
			<form id="form1" method="POST">
				<?php 
$uploader = new PhpUploader();
$uploader->MaxSizeKB = 10240;
$uploader->Name = "myuploader";
$uploader->InsertText = "Select multiple files (Max 10M)";
$uploader->AllowedFileExtensions = "*.jpg,*.png,*.gif,*.txt,*.zip,*.rar";
$uploader->MultipleFilesUpload = true;
$uploader->ManualStartUpload = true;
$uploader->Render();
?>
				<br /><br /><br />
				<button id="submitbutton" onclick="doStart();return false;">Start Uploading Files</button>

			</form>
			
			<br/><br/><br/>
<?php