本文整理汇总了PHP中G::uploadFile方法的典型用法代码示例。如果您正苦于以下问题:PHP G::uploadFile方法的具体用法?PHP G::uploadFile怎么用?PHP G::uploadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G
的用法示例。
在下文中一共展示了G::uploadFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveConfigPmGmail
public function saveConfigPmGmail($httpData)
{
G::LoadClass("pmGoogleApi");
$pmGoogle = new PMGoogleApi();
$result = new StdClass();
$result->success = true;
if (!empty($httpData->status_pmgmail)) {
$httpData->status_pmgmail = $httpData->status_pmgmail == 1 ? true : false;
$pmGoogle->setStatusService($httpData->status_pmgmail);
$message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . ($httpData->status_pmgmail ? G::LoadTranslation('ID_ENABLE') : G::LoadTranslation('ID_DISABLE'));
$pmGoogle->setTypeAuthentication($httpData->typeAuth);
if (!empty($httpData->email_service_account)) {
$pmGoogle->setServiceAccountEmail($httpData->email_service_account);
$message .= ', ' . G::LoadTranslation('ID_PMG_EMAIL') . ': ' . $httpData->email_service_account;
}
if (!empty($_FILES)) {
if (!empty($_FILES['file_p12']) && $_FILES['file_p12']['error'] != 1) {
if ($_FILES['file_p12']['tmp_name'] != '') {
G::uploadFile($_FILES['file_p12']['tmp_name'], PATH_DATA_SITE, $_FILES['file_p12']['name']);
$pmGoogle->setServiceAccountP12($_FILES['file_p12']['name']);
$message .= ', ' . G::LoadTranslation('ID_PMG_FILE') . ': ' . $_FILES['file_p12']['name'];
}
} else {
if (!empty($_FILES['file_json']) && $_FILES['file_json']['error'] != 1) {
if ($_FILES['file_json']['tmp_name'] != '') {
G::uploadFile($_FILES['file_json']['tmp_name'], PATH_DATA_SITE, $_FILES['file_json']['name']);
$pmGoogle->setAccountJson($_FILES['file_json']['name']);
$message .= ', ' . G::LoadTranslation('ID_PMG_FILE') . ': ' . $_FILES['file_json']['name'];
}
} else {
$result->success = false;
$result->fileError = true;
print G::json_encode($result);
die;
}
}
}
} else {
$pmGoogle->setStatusService(false);
$message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . G::LoadTranslation('ID_DISABLE');
}
G::auditLog("Update Settings Gmail", $message);
print G::json_encode($result);
}
示例2: uploadFile
/**
* Upload file
*
* @param array $aData
*/
public function uploadFile($aData)
{
try {
if ($_FILES['file_content']['error'] != 1) {
if ($_FILES['file_content']['tmp_name'] != '') {
$aAux = explode('.', $_FILES['file_content']['name']);
$content = file_get_contents($_FILES['file_content']['tmp_name']);
$result = array('file_content' => $content);
\G::uploadFile($_FILES['file_content']['tmp_name'], PATH_DOCUMENT . '/upload/', $_FILES['file_content']['name']);
}
} else {
$result->success = false;
$result->fileError = true;
throw new \Exception($result);
}
return $result;
} catch (\Exception $e) {
throw $e;
}
}
示例3: uploadProcessFilesManager
/**
* Return the Process Files Manager
*
* @param string $prjUid {@min 32} {@max 32}
* @param string $prfUid {@min 32} {@max 32}
*
*
* @access public
*/
public function uploadProcessFilesManager($prjUid, $prfUid)
{
try {
$path = '';
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\ProcessFilesPeer::PRF_PATH);
$criteria->add(\ProcessFilesPeer::PRF_UID, $prfUid, \Criteria::EQUAL);
$rsCriteria = \ProcessFilesPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
while ($aRow = $rsCriteria->getRow()) {
$path = $aRow['PRF_PATH'];
$rsCriteria->next();
}
if ($path == '') {
throw new \Exception(\G::LoadTranslation('ID_PMTABLE_UPLOADING_FILE_PROBLEM'));
}
$extention = strstr($_FILES['prf_file']['name'], '.');
if (!$extention) {
$extention = '.html';
$_FILES['prf_file']['name'] = $_FILES['prf_file']['name'].$extention;
}
$file = end(explode("/",$path));
if(strpos($file,"\\") > 0) {
$file = str_replace('\\', '/', $file);
$file = end(explode("/",$file));
}
$path = str_replace($file,'',$path);
if ($file == $_FILES['prf_file']['name']) {
if ($_FILES['prf_file']['error'] != 1) {
if ($_FILES['prf_file']['tmp_name'] != '') {
\G::uploadFile($_FILES['prf_file']['tmp_name'], $path, $_FILES['prf_file']['name']);
}
}
} else {
throw new \Exception(\G::LoadTranslation('ID_PMTABLE_UPLOADING_FILE_PROBLEM'));
}
$oProcessFile = array('prf_uid' => $prfUid);
return $oProcessFile;
} catch (Exception $e) {
throw $e;
}
}
示例4: uploadImage
/**
* Upload Image
* @global type $_FILES
*/
public function uploadImage()
{
//!dataSystem
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$_SERVER["REQUEST_URI"] = $filter->xssFilterHard($_SERVER["REQUEST_URI"]);
$_FILES = $filter->xssFilterHard($_FILES);
$ainfoSite = explode("/", $_SERVER["REQUEST_URI"]);
$dir = PATH_DATA . "sites" . PATH_SEP . str_replace("sys", "", $ainfoSite[1]) . PATH_SEP . "files/logos";
global $_FILES;
//| 0-> non fail
//| 1-> fail in de type of the image
//| 2-> fail in de size of the image
//| 3-> fail in de myme of the image
$failed = 0;
//!dataSystem
$ori_dir = $dir . '/img/ori/';
$thumb_dir = $dir . '/img/thumbs/';
$allowedType = array('image/jpg', 'image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png');
$allowedTypeArray['index' . base64_encode('image/jpg')] = IMAGETYPE_JPEG;
$allowedTypeArray['index' . base64_encode('image/jpeg')] = IMAGETYPE_JPEG;
$allowedTypeArray['index' . base64_encode('image/pjpeg')] = IMAGETYPE_JPEG;
$allowedTypeArray['index' . base64_encode('image/gif')] = IMAGETYPE_GIF;
$allowedTypeArray['index' . base64_encode('image/png')] = IMAGETYPE_PNG;
$allowedTypeArray['index' . base64_encode('image/x-png')] = IMAGETYPE_PNG;
$uploaded = 0;
$failed = 0;
$files_img_type = $_FILES['img']['type'];
if (in_array($files_img_type, $allowedType)) {
// max upload file is 500 KB
if ($_FILES['img']['size'] <= 500000) {
$formf = $_FILES['img'];
$namefile = $formf['name'];
$typefile = $formf['type'];
$errorfile = $formf['error'];
$tmpFile = $formf['tmp_name'];
$aMessage1 = array();
$fileName = trim(str_replace(' ', '_', $namefile));
$fileName = self::changeNamelogo($fileName);
G::uploadFile($tmpFile, $dir, 'tmp' . $fileName);
try {
if (extension_loaded('exif')) {
$typeMime = exif_imagetype($dir . '/' . 'tmp' . $fileName);
} else {
$arrayInfo = getimagesize($dir . '/' . 'tmp' . $fileName);
$typeMime = $arrayInfo[2];
}
if ($typeMime == $allowedTypeArray['index' . base64_encode($files_img_type)]) {
$error = false;
try {
list($imageWidth, $imageHeight, $imageType) = @getimagesize($dir . '/' . 'tmp' . $fileName);
G::resizeImage($dir . '/tmp' . $fileName, $imageWidth, 49, $dir . '/' . $fileName);
G::auditLog("UploadLogo", "File Name: " . $fileName);
} catch (Exception $e) {
$error = $e->getMessage();
}
$uploaded++;
} else {
$failed = "3";
}
$path = $filter->xssFilterHard($dir . '/tmp' . $fileName, 'path');
unlink($path);
} catch (Exception $e) {
$failed = "3";
}
} else {
$failed = "2";
}
} elseif ($files_img_type != '') {
$failed = "1";
}
$uploaded = $filter->validateInput($uploaded, 'int');
$files_img_type = $filter->xssFilterHard($files_img_type);
$failed = $filter->validateInput($failed, 'int');
$resp = array('success' => true, 'failed' => $failed, 'uploaded' => $uploaded, 'type' => $files_img_type);
echo G::json_encode($resp);
exit;
}
示例5: import
/**
* import a pm table
*
* @param string $httpData->id
*/
public function import($httpData)
{
require_once 'classes/model/AdditionalTables.php';
try {
$errors = '';
$overWrite = isset($_POST['form']['OVERWRITE']) ? true : false;
//save the file
if ($_FILES['form']['error']['FILENAME'] !== 0) {
throw new Exception(G::loadTranslation('ID_PMTABLE_UPLOADING_FILE_PROBLEM'));
}
$oAdditionalTables = new AdditionalTables();
$tableNameMap = array();
$processQueue = array();
$processQueueTables = array();
$PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP;
$filename = $_FILES['form']['name']['FILENAME'];
$tempName = $_FILES['form']['tmp_name']['FILENAME'];
G::uploadFile($tempName, $PUBLIC_ROOT_PATH, $filename);
$fileContent = file_get_contents($PUBLIC_ROOT_PATH . $filename);
if (strpos($fileContent, '-----== ProcessMaker Open Source Private Tables ==-----') === false) {
throw new Exception(G::loadTranslation('ID_PMTABLE_INVALID_FILE'));
}
$fp = fopen($PUBLIC_ROOT_PATH . $filename, "rb");
$fsData = intval(fread($fp, 9));
//reading the metadata
$sType = fread($fp, $fsData);
// first create the tables structures
while (!feof($fp)) {
switch ($sType) {
case '@META':
$fsData = intval(fread($fp, 9));
$METADATA = fread($fp, $fsData);
break;
case '@SCHEMA':
$fsUid = intval(fread($fp, 9));
$uid = fread($fp, $fsUid);
$fsData = intval(fread($fp, 9));
$schema = fread($fp, $fsData);
$contentSchema = unserialize($schema);
$additionalTable = new additionalTables();
$tableExists = $additionalTable->loadByName($contentSchema['ADD_TAB_NAME']);
$tableNameMap[$contentSchema['ADD_TAB_NAME']] = $contentSchema['ADD_TAB_NAME'];
if ($overWrite) {
if ($tableExists !== false) {
$additionalTable->deleteAll($tableExists['ADD_TAB_UID']);
}
} else {
if ($tableExists !== false) {
// some table exists with the same name
// renaming...
$tNameOld = $contentSchema['ADD_TAB_NAME'];
$newTableName = $contentSchema['ADD_TAB_NAME'] . '_' . date('YmdHis');
$contentSchema['ADD_TAB_UID'] = G::generateUniqueID();
$contentSchema['ADD_TAB_NAME'] = $newTableName;
$contentSchema['ADD_TAB_CLASS_NAME'] = additionalTables::getPHPName($newTableName);
//mapping the table name for posterior uses
$tableNameMap[$tNameOld] = $contentSchema['ADD_TAB_NAME'];
}
}
// validating invalid bds_uid in old tables definition -> mapped to workflow
if (!$contentSchema['DBS_UID'] || $contentSchema['DBS_UID'] == '0' || !$contentSchema['DBS_UID']) {
$contentSchema['DBS_UID'] = 'workflow';
}
$columns = array();
foreach ($contentSchema['FIELDS'] as $field) {
$column = array('uid' => '', 'field_uid' => '', 'field_name' => $field['FLD_NAME'], 'field_dyn' => isset($field['FLD_DYN_NAME']) ? $field['FLD_DYN_NAME'] : '', 'field_label' => isset($field['FLD_DESCRIPTION']) ? $field['FLD_DESCRIPTION'] : '', 'field_type' => $field['FLD_TYPE'], 'field_size' => $field['FLD_SIZE'], 'field_key' => isset($field['FLD_KEY']) ? $field['FLD_KEY'] : 0, 'field_null' => isset($field['FLD_NULL']) ? $field['FLD_NULL'] : 1, 'field_autoincrement' => isset($field['FLD_AUTO_INCREMENT']) ? $field['FLD_AUTO_INCREMENT'] : 0);
$columns[] = $column;
}
$tableData = new stdClass();
$tableData->REP_TAB_UID = $contentSchema['ADD_TAB_UID'];
$tableData->REP_TAB_NAME = $contentSchema['ADD_TAB_NAME'];
$tableData->REP_TAB_DSC = $contentSchema['ADD_TAB_DESCRIPTION'];
$tableData->REP_TAB_CONNECTION = $contentSchema['DBS_UID'];
if (isset($_POST["form"]["PRO_UID"]) && !empty($_POST["form"]["PRO_UID"])) {
$tableData->PRO_UID = $_POST["form"]["PRO_UID"];
} else {
$tableData->PRO_UID = isset($contentSchema["PRO_UID"]) ? $contentSchema["PRO_UID"] : "";
}
$tableData->REP_TAB_TYPE = isset($contentSchema['ADD_TAB_TYPE']) ? $contentSchema['ADD_TAB_TYPE'] : '';
$tableData->REP_TAB_GRID = isset($contentSchema['ADD_TAB_GRID']) ? $contentSchema['ADD_TAB_GRID'] : '';
$tableData->columns = G::json_encode($columns);
$tableData->forceUid = true;
//save the table
$alterTable = false;
$result = $this->save($tableData, $alterTable);
if ($result->success) {
$processQueueTables[$contentSchema['DBS_UID']][] = $contentSchema['ADD_TAB_NAME'];
} else {
$errors .= 'Error creating table: ' . $tableData->REP_TAB_NAME . '-> ' . $result->message . "\n\n";
}
break;
case '@DATA':
$fstName = intval(fread($fp, 9));
$tableName = fread($fp, $fstName);
$fsData = intval(fread($fp, 9));
//.........这里部分代码省略.........
示例6: array
default:
//New
$aFields = array('APP_UID' => $appId, 'DEL_INDEX' => isset($_SESSION['INDEX']) ? $_SESSION['INDEX'] : 1, 'USR_UID' => $_SESSION['USER_LOGGED'], 'DOC_UID' => $docUid, 'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'], 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', 'APP_DOC_TITLE' => '', 'APP_DOC_FILENAME' => isset($_FILES['form']['name']['APP_DOC_FILENAME']) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '', 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
$oAppDocument->create($aFields);
break;
}
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo($oAppDocument->getAppDocFilename());
$ext = isset($info['extension']) ? $info['extension'] : '';
//save the file
if (!empty($_FILES['form'])) {
if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
$sPathName = PATH_DOCUMENT . $appId . PATH_SEP;
$sFileName = $sAppDocUid . "_" . $iDocVersion . '.' . $ext;
G::uploadFile($_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName);
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists('uploadDocumentData')) {
$oData['APP_UID'] = $appId;
$documentData = new uploadDocumentData($appId, $_SESSION['USER_LOGGED'], $sPathName . $sFileName, $aFields['APP_DOC_FILENAME'], $sAppDocUid);
$oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
unlink($sPathName . $sFileName);
}
//end plugin
}
}
G::header('location: appFolderList');
die;
} catch (Exception $e) {
/* Render Error page */
示例7: addInputDocument
//.........这里部分代码省略.........
);
$appDocument->create($arrayField);
break;
}
//Save the file
$appDocUid = $appDocument->getAppDocUid();
$docVersion = $appDocument->getDocVersion();
$arrayInfo = pathinfo($appDocument->getAppDocFilename());
$extension = (isset($arrayInfo["extension"])) ? $arrayInfo["extension"] : null;
$strPathName = PATH_DOCUMENT . G::getPathFromUID($applicationUid) . PATH_SEP;
$strFileName = $appDocUid . "_" . $docVersion . "." . $extension;
switch ($option) {
case "xmlform":
G::uploadFile($fileTmpName, $strPathName, $strFileName);
break;
case "file":
$umaskOld = umask(0);
if (!is_dir($strPathName)) {
G::verifyPath($strPathName, true);
}
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$file = $filter->xssFilterHard($file, 'path');
copy($file, $strPathName . $strFileName);
chmod($strPathName . $strFileName, 0666);
umask($umaskOld);
break;
示例8: Configurations
$configuration = new Configurations();
$importResults = $language->import($languageFile);
G::LoadClass("wsTools");
$renegerateContent = new workspaceTools(SYS_SYS);
$messs = $renegerateContent->upgradeContent();
$result->msg = G::LoadTranslation('IMPORT_LANGUAGE_SUCCESS') . "\n";
$result->msg .= G::LoadTranslation("ID_FILE_NUM_RECORD") . $importResults->recordsCount . "\n";
$result->msg .= G::LoadTranslation("ID_SUCCESS_RECORD") . $importResults->recordsCountSuccess . "\n";
$result->msg .= G::LoadTranslation("ID_FAILED_RECORD") . ($importResults->recordsCount - $importResults->recordsCountSuccess) . "\n";
if ($importResults->errMsg != '') {
$result->msg .= G::LoadTranslation("ID_ERROR_REGISTERED") . " \n" . $importResults->errMsg . "\n";
}
//$result->msg = htmlentities($result->msg);
$result->success = true;
//saving metadata
$configuration->aConfig = array('headers' => $importResults->headers, 'language' => $importResults->lang, 'import-date' => date('Y-m-d H:i:s'), 'user' => '', 'version' => '1.0');
$configuration->saveConfig('LANGUAGE_META', $importResults->lang);
$dir = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP;
if (!is_writable($dir)) {
throw new Exception(G::LoadTranslation('ID_TRANSLATIONS_FOLDER_PERMISSIONS'));
}
G::uploadFile($languageFile, $dir, $languageFilename, 0777);
ini_set('max_execution_time', $sMaxExecutionTime);
} catch (Exception $oError) {
$result->msg = $oError->getMessage();
//print_r($oError->getTrace());
$result->success = false;
//G::SendTemporalMessage($oError->getMessage(), 'error', 'string');
//G::header('location: languages_ImportForm');
}
echo G::json_encode($result);
示例9: Exception
*
*/
global $RBAC;
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
try {
//load the variables
G::LoadClass('plugin');
if (!isset($_FILES['form']['error']['PLUGIN_FILENAME']) || $_FILES['form']['error']['PLUGIN_FILENAME'] == 1) {
throw new Exception(G::loadTranslation('ID_ERROR_UPLOADING_PLUGIN_FILENAME'));
}
//save the file
if ($_FILES['form']['error']['PLUGIN_FILENAME'] == 0) {
$filename = $_FILES['form']['name']['PLUGIN_FILENAME'];
$path = PATH_DOCUMENT . 'input' . PATH_SEP;
$tempName = $_FILES['form']['tmp_name']['PLUGIN_FILENAME'];
G::uploadFile($tempName, $path, $filename);
}
//save the files Enterprise
if ($_FILES['form']['error']['PLUGIN_FILENAME'] == 0) {
$filename = $_FILES['form']['name']['PLUGIN_FILENAME'];
$path = PATH_DOCUMENT . 'input' . PATH_SEP;
if (strpos($filename, 'enterprise') !== false) {
G::LoadThirdParty('pear/Archive', 'Tar');
$tar = new Archive_Tar($path . $filename);
$sFileName = substr($filename, 0, strrpos($filename, '.'));
$sClassName = substr($filename, 0, strpos($filename, '-'));
$sClassName = !empty($sClassName) ? $sClassName : $sFileName;
$files = $tar->listContent();
$licenseName = '';
$listFiles = array();
foreach ($files as $key => $val) {
示例10: AppFolder
$oFolder = new AppFolder();
$folderId = $oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH']);
//Tags
$fileTags = $oFolder->parseTags($aID['INP_DOC_TAGS']);
$aFields = array('APP_UID' => $_SESSION['APPLICATION'], 'DEL_INDEX' => $_SESSION['INDEX'], 'USR_UID' => $_SESSION['USER_LOGGED'], 'DOC_UID' => $_POST['INPUTS'][$sFieldName], 'APP_DOC_TYPE' => 'INPUT', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_COMMENT' => '', 'APP_DOC_TITLE' => '', 'APP_DOC_FILENAME' => $_FILES['form']['name'][$sFieldName], 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
} else {
$aFields = array('APP_UID' => $_SESSION['APPLICATION'], 'DEL_INDEX' => $_SESSION['INDEX'], 'USR_UID' => $_SESSION['USER_LOGGED'], 'DOC_UID' => -1, 'APP_DOC_TYPE' => 'ATTACHED', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_COMMENT' => '', 'APP_DOC_TITLE' => '', 'APP_DOC_FILENAME' => $_FILES['form']['name'][$sFieldName]);
}
$oAppDocument->create($aFields);
$iDocVersion = $oAppDocument->getDocVersion();
$sAppDocUid = $oAppDocument->getAppDocUid();
$aInfo = pathinfo($oAppDocument->getAppDocFilename());
$sExtension = isset($aInfo['extension']) ? $aInfo['extension'] : '';
$sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP;
$sFileName = $sAppDocUid . '_' . $iDocVersion . '.' . $sExtension;
G::uploadFile($_FILES['form']['tmp_name'][$sFieldName], $sPathName, $sFileName);
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) {
$triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
$documentData = new uploadDocumentData($_SESSION["APPLICATION"], $_SESSION["USER_LOGGED"], $sPathName . $sFileName, $aFields["APP_DOC_FILENAME"], $sAppDocUid, $iDocVersion);
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace;
if (!isset($aFields["APP_DOC_UID"])) {
$aFields["APP_DOC_UID"] = $sAppDocUid;
}
if (!isset($aFields["DOC_VERSION"])) {
$aFields["DOC_VERSION"] = $iDocVersion;
}
$oAppDocument->update($aFields);
示例11: array
//$aFields['FOLDER_UID'] = $folderId,
//$aFields['APP_DOC_TAGS']= $fileTags
} else {
//New record
$aFields = array('APP_UID' => $_POST['APPLICATION'], 'DEL_INDEX' => $_POST['INDEX'], 'USR_UID' => $_POST['USR_UID'], 'DOC_UID' => $_POST['DOC_UID'], 'APP_DOC_TYPE' => $_POST['APP_DOC_TYPE'], 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_COMMENT' => isset($_POST['COMMENT']) ? $_POST['COMMENT'] : '', 'APP_DOC_TITLE' => isset($_POST['TITLE']) ? $_POST['TITLE'] : '', 'APP_DOC_FILENAME' => isset($_FILES['ATTACH_FILE']['name']) ? $_FILES['ATTACH_FILE']['name'] : '', 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
}
$oAppDocument->create($aFields);
$sAppUid = $oAppDocument->getAppUid();
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo($oAppDocument->getAppDocFilename());
$ext = isset($info['extension']) ? $info['extension'] : '';
//Save the file
echo $sPathName = PATH_DOCUMENT . $sAppUid . PATH_SEP;
echo $sFileName = $sAppDocUid . '_' . $iDocVersion . '.' . $ext;
print G::uploadFile($_FILES['ATTACH_FILE']['tmp_name'], $sPathName, $sFileName);
print "* The file {$_FILES['ATTACH_FILE']['name']} was uploaded successfully in case {$sAppUid} as input document..\n";
//Get current Application Fields
$application = new Application();
$appFields = $application->Load($_POST['APPLICATION']);
$appFields = unserialize($appFields['APP_DATA']);
$_SESSION['APPLICATION'] = $appFields['APPLICATION'];
$_SESSION['PROCESS'] = $appFields['PROCESS'];
$_SESSION['TASK'] = $appFields['TASK'];
$_SESSION['INDEX'] = $appFields['INDEX'];
$_SESSION['USER_LOGGED'] = $appFields['USER_LOGGED'];
//$_POST['USR_UID']
//$_SESSION['USR_USERNAME'] = $appFields['USR_USERNAME'];
//$_SESSION['STEP_POSITION'] = 0;
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry =& PMPluginRegistry::getSingleton();
示例12: uploadExternalDocument
//.........这里部分代码省略.........
'DOC_UID' => $docUid,
'APP_DOC_TYPE' => $docType,
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ?
$_POST['form']['APP_DOC_COMMENT'] : '',
'APP_DOC_TITLE' => '',
'APP_DOC_FILENAME' => $fileObj['fileName'],
'FOLDER_UID' => $folderId,
'APP_DOC_TAGS' => $fileTags
);
$oAppDocument->create($aFields);
break;
default:
//New
$aFields = array(
'APP_UID' => $appId,
'DEL_INDEX' => isset($_SESSION['INDEX'])?$_SESSION['INDEX']:1,
'USR_UID' => $_SESSION['USER_LOGGED'],
'DOC_UID' => $docUid,
'APP_DOC_TYPE' => $docType,
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ?
$_POST['form']['APP_DOC_COMMENT'] : '',
'APP_DOC_TITLE' => '',
'APP_DOC_FILENAME' => $fileObj['fileName'],
'FOLDER_UID' => $folderId,
'APP_DOC_TAGS' => $fileTags
);
$oAppDocument->create($aFields);
break;
}
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo($oAppDocument->getAppDocFilename());
$ext = (isset($info['extension']) ? $info['extension'] : '');
//save the file
//if (!empty($_FILES['form'])) {
//if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
$sPathName = PATH_DOCUMENT . G::getPathFromUID($appId) . PATH_SEP;
$file = G::getPathFromFileUID($appId, $sAppDocUid);
$sPathName .= $file[0];
$sFileName = $file[1] . "_" . $iDocVersion . '.' . $ext;
G::uploadFile($fileObj['tempName'], $sPathName, $sFileName); //upload
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger (PM_UPLOAD_DOCUMENT) && class_exists ('uploadDocumentData')) {
$oData['APP_UID'] = $appId;
$documentData = new uploadDocumentData (
$appId,
$_SESSION['USER_LOGGED'],
$sPathName . $sFileName,
$fileObj['fileName'],
$sAppDocUid
);
//$oPluginRegistry->executeTriggers (PM_UPLOAD_DOCUMENT , $documentData);
//unlink ($sPathName . $sFileName);
}
//end plugin
if ($sw_error) {
// there were errors
$err_msg="";
for ($i=0; $i<$uploadedInstances; $i++) {
if ($errors[$i]==null) {
continue;
}
$err_msg .= $items[$i]." : ".$errors[$i]."\n";
}
$response['error']=$err_msg;
$response['message']=$err_msg;
$response['success']=false;
} elseif ($emptyInstances==$uploadedInstances) {
$response['error']= G::LoadTranslation('ID_UPLOAD_LEAST_FILE');
$response['message']= G::LoadTranslation('ID_UPLOAD_LEAST_FILE');
$response['success']=false;
} else {
$response['error']= G::LoadTranslation('ID_UPLOAD_COMPLETE');
$response['message']="Upload complete";
$response['success']=true;
}
}
}
}
print_r(G::json_encode($response));
/*
G::LoadClass ('case');
$oCase = new Cases ();
$G_PUBLISH = new Publisher ();
$Fields ['DOC_UID'] = "-1";
$Fields ['appId'] = "00000000000000000000000000000000";
$G_PUBLISH->AddContent ('xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields,
'appFolderSaveDocument?UID=-1&appId=' . $Fields ['appId'] . "&folderId=" . $_POST ['folderID']);
G::RenderPage ('publish', 'raw');
*/
}
示例13: Exception
<?php
try {
require_once 'classes/model/OutputDocument.php';
if (empty($_FILES['form']) || $_FILES['form']['name']['OUT_DOC_FILE'] == '') {
throw new Exception('you must upload a file.');
}
$uid = $_POST['form']['OUT_DOC_UID'];
$oOutputDocument = new OutputDocument();
$aFields = $oOutputDocument->load($uid);
$type = $aFields['OUT_DOC_TYPE'];
$aExtension = explode('.', strtolower(basename($_FILES['form']['name']['OUT_DOC_FILE'])));
$extension = $aExtension[count($aExtension) - 1];
if ($extension != 'jrxml' && $type == 'JRXML') {
throw new Exception("'{$extension}' is not a valid extension, you must upload a .jrxml file.");
}
if ($extension != 'pdf' && $type == 'ACROFORM') {
throw new Exception("'{$extension}' is not a valid extension, you must upload a .pdf file.");
}
$fileJrxml = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $aFields['OUT_DOC_UID'] . '.' . $extension;
if (!empty($_FILES['form'])) {
if ($_FILES['form']['error']['OUT_DOC_FILE'] == 0) {
G::uploadFile($_FILES['form']['tmp_name']['OUT_DOC_FILE'], dirname($fileJrxml), basename($fileJrxml));
}
}
print "<font face='Arial' size='2' >File uploaded.</font>";
} catch (Exception $e) {
print "<font face='Arial' size='2' color='red' >Error: " . $e->getMessage() . "</font>";
}
示例14: uploadImage
/**
* Upload Image
* @global type $_FILES
*/
public function uploadImage()
{
//!dataSystem
$ainfoSite = explode("/", $_SERVER["REQUEST_URI"]);
$dir = PATH_DATA . "sites" . PATH_SEP . str_replace("sys", "", $ainfoSite[1]) . PATH_SEP . "files/logos";
global $_FILES;
//| 0-> non fail
//| 1-> fail in de type of the image
//| 2-> fail in de size of the image
//| 3-> fail in de myme of the image
$failed = 0;
//!dataSystem
$ori_dir = $dir . '/img/ori/';
$thumb_dir = $dir . '/img/thumbs/';
$allowedType = array('image/jpg', 'image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png');
$allowedTypeArray['index' . base64_encode('image/jpg')] = IMAGETYPE_JPEG;
$allowedTypeArray['index' . base64_encode('image/jpeg')] = IMAGETYPE_JPEG;
$allowedTypeArray['index' . base64_encode('image/pjpeg')] = IMAGETYPE_JPEG;
$allowedTypeArray['index' . base64_encode('image/gif')] = IMAGETYPE_GIF;
$allowedTypeArray['index' . base64_encode('image/png')] = IMAGETYPE_PNG;
$allowedTypeArray['index' . base64_encode('image/x-png')] = IMAGETYPE_PNG;
$uploaded = 0;
$failed = 0;
if (in_array($_FILES['img']['type'], $allowedType)) {
// max upload file is 500 KB
if ($_FILES['img']['size'] <= 500000) {
$formf = $_FILES['img'];
$namefile = $formf['name'];
$typefile = $formf['type'];
$errorfile = $formf['error'];
$tmpFile = $formf['tmp_name'];
$aMessage1 = array();
$fileName = trim(str_replace(' ', '_', $namefile));
$fileName = self::changeNamelogo($fileName);
G::uploadFile($tmpFile, $dir, 'tmp' . $fileName);
try {
if (extension_loaded('exif')) {
$typeMime = exif_imagetype($dir . '/' . 'tmp' . $fileName);
} else {
$arrayInfo = getimagesize($dir . '/' . 'tmp' . $fileName);
$typeMime = $arrayInfo[2];
}
if ($typeMime == $allowedTypeArray['index' . base64_encode($_FILES['img']['type'])]) {
$error = false;
try {
list($imageWidth, $imageHeight, $imageType) = @getimagesize($dir . '/' . 'tmp' . $fileName);
G::resizeImage($dir . '/tmp' . $fileName, $imageWidth, 49, $dir . '/' . $fileName);
} catch (Exception $e) {
$error = $e->getMessage();
}
$uploaded++;
} else {
$failed = "3";
}
unlink($dir . '/tmp' . $fileName);
} catch (Exception $e) {
$failed = "3";
}
} else {
$failed = "2";
}
} elseif ($_FILES['img']['type'] != '') {
$failed = "1";
}
echo '{success: true, failed: ' . $failed . ', uploaded: ' . $uploaded . ', type: "' . $_FILES['img']['type'] . '"}';
exit;
}
示例15: array
//$aFields["APP_DOC_TAGS"] = $fileTags
$aFields["APP_DOC_FIELDNAME"] = $_POST["APP_DOC_FIELDNAME"];
} else {
//New record
$aFields = array("APP_UID" => $_POST["APPLICATION"], "DEL_INDEX" => $_POST["INDEX"], "USR_UID" => $_POST["USR_UID"], "DOC_UID" => $_POST["DOC_UID"], "APP_DOC_TYPE" => $_POST["APP_DOC_TYPE"], "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), "APP_DOC_COMMENT" => isset($_POST["COMMENT"]) ? $_POST["COMMENT"] : "", "APP_DOC_TITLE" => isset($_POST["TITLE"]) ? $_POST["TITLE"] : "", "APP_DOC_FILENAME" => isset($_FILES["ATTACH_FILE"]["name"]) ? $_FILES["ATTACH_FILE"]["name"] : "", "FOLDER_UID" => $folderId, "APP_DOC_TAGS" => $fileTags, "APP_DOC_FIELDNAME" => $_POST["APP_DOC_FIELDNAME"]);
}
$oAppDocument->create($aFields);
$sAppUid = $oAppDocument->getAppUid();
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo($oAppDocument->getAppDocFilename());
$ext = isset($info["extension"]) ? $info["extension"] : "";
//Save the file
echo $sPathName = PATH_DOCUMENT . $sAppUid . PATH_SEP;
echo $sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $ext;
print G::uploadFile($_FILES["ATTACH_FILE"]["tmp_name"], $sPathName, $sFileName);
print "* The file " . $_FILES["ATTACH_FILE"]["name"] . " was uploaded successfully in case " . $sAppUid . " as input document..\n";
//Get current Application Fields
$application = new Application();
$appFields = $application->Load($_POST["APPLICATION"]);
$appFields = unserialize($appFields["APP_DATA"]);
$_SESSION["APPLICATION"] = $appFields["APPLICATION"];
$_SESSION["PROCESS"] = $appFields["PROCESS"];
$_SESSION["TASK"] = $appFields["TASK"];
$_SESSION["INDEX"] = $appFields["INDEX"];
$_SESSION["USER_LOGGED"] = $appFields["USER_LOGGED"];
//$_POST["USR_UID"]
//$_SESSION["USR_USERNAME"] = $appFields["USR_USERNAME"];
//$_SESSION["STEP_POSITION"] = 0;
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry =& PMPluginRegistry::getSingleton();