本文整理汇总了PHP中File_Archive::readUploadedFile方法的典型用法代码示例。如果您正苦于以下问题:PHP File_Archive::readUploadedFile方法的具体用法?PHP File_Archive::readUploadedFile怎么用?PHP File_Archive::readUploadedFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File_Archive
的用法示例。
在下文中一共展示了File_Archive::readUploadedFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
$oKTConfig =& KTConfig::getSingleton();
$sBasedir = $oKTConfig->get("urls/tmpDirectory");
$sTmpPath = tempnam($sBasedir, 'archiveimportstorage');
if ($sTmpPath === false) {
return PEAR::raiseError(_kt("Could not create temporary directory for archive storage"));
}
if (!file_exists($this->sZipPath)) {
return PEAR::raiseError(_kt("Archive file given does not exist"));
}
unlink($sTmpPath);
mkdir($sTmpPath, 0700);
$this->sBasePath = $sTmpPath;
// Set environment language to output character encoding
$sOutputEncoding = $oKTConfig->get('export/encoding', 'UTF-8');
$loc = $sOutputEncoding;
putenv("LANG={$loc}");
putenv("LANGUAGE={$loc}");
$loc = setlocale(LC_ALL, $loc);
// File Archive doesn't unzip properly so sticking to the original unzip functionality
if ($this->sExtension == 'zip') {
// ** Original zip functionality
$sUnzipCommand = KTUtil::findCommand("import/unzip", "unzip");
if (empty($sUnzipCommand)) {
return PEAR::raiseError(_kt("unzip command not found on system"));
}
$aArgs = array($sUnzipCommand, "-q", "-n", "-d", $sTmpPath, $this->sZipPath);
$aRes = KTUtil::pexec($aArgs);
if ($aRes['ret'] !== 0) {
return PEAR::raiseError(_kt("Could not retrieve contents from zip storage"));
}
} else {
File_Archive::extract(File_Archive::readArchive($this->sExtension, File_Archive::readUploadedFile('file')), $dst = $sTmpPath);
}
}