本文整理汇总了PHP中upload::setLogging方法的典型用法代码示例。如果您正苦于以下问题:PHP upload::setLogging方法的具体用法?PHP upload::setLogging怎么用?PHP upload::setLogging使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类upload
的用法示例。
在下文中一共展示了upload::setLogging方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nf_uploadfile
function nf_uploadfile($filename, &$upload_file, $allowablefiletypes, $filestore_path)
{
global $_FILES, $_CONF, $_TABLES, $CONF_NF, $LANG_GF00;
include_once $_CONF['path_system'] . 'classes/upload.class.php';
$upload = new upload();
$upload->setPath($filestore_path);
$upload->setLogging(true);
$upload->setAutomaticResize(false);
$upload->setAllowedMimeTypes($allowablefiletypes);
$upload->setMaxFileSize($CONF_NF['max_uploadfile_size']);
if (strlen($upload_file['name']) > 0) {
$upload->setFileNames($filename);
$upload->setPerms($CONF_NF['fileperms']);
$upload->_currentFile = $upload_file;
// Verify file meets size limitations
if (!$upload->_fileSizeOk()) {
$upload->_addError('File, ' . $upload->_currentFile['name'] . ', is bigger than the ' . $upload->_maxFileSize . ' byte limit');
}
// If all systems check, do the upload
if ($upload->checkMimeType() and $upload->_imageSizeOK() and !$upload->areErrors()) {
if ($upload->_copyFile()) {
$upload->_uploadedFiles[] = $upload->_fileUploadDirectory . '/' . $upload->_getDestinationName();
}
}
$upload->_currentFile = array();
if ($upload->areErrors() and !$upload->_continueOnError) {
$errmsg = "Workflow Upload Attachment Error:" . $upload->printErrors(false);
COM_errorlog($errmsg);
$GLOBALS['nf_errmsg'] = $LANG_GF00['uploaderr'] . ':<BR>' . $upload->printErrors(false);
return false;
}
return true;
} else {
return false;
}
return false;
}
示例2: testSetLoggingFail
public function testSetLoggingFail()
{
// see testSetLogFileFail() ...
$this->up->setLogging(true);
$this->assertFalse($this->up->loggingEnabled());
}
示例3: nexform_uploadfile
function nexform_uploadfile($filename, &$upload_file, $allowablefiletypes)
{
global $_FILES, $_CONF, $_TABLES, $CONF_FE, $LANG_FE_ERR;
include_once $_CONF['path_system'] . 'classes/upload.class.php';
$upload = new upload();
$upload->setPath($CONF_FE['uploadpath']);
$upload->setLogging(true);
$upload->setAutomaticResize(false);
$upload->setAllowedMimeTypes($allowablefiletypes);
// Set max dimensions as well in case user is uploading a full size image
$upload->setMaxDimensions($CONF_FE['max_uploadimage_width'], $CONF_FE['max_uploadimage_height']);
$upload->setMaxFileSize($CONF_FE['max_uploadfile_size']);
if (strlen($upload_file['name']) > 0) {
$upload->setFileNames($filename);
$upload->setPerms(FE_CHMOD_FILES);
$upload->_currentFile = $upload_file;
// Verify file meets size limitations
if (!$upload->_fileSizeOk()) {
$upload->_addError('File, ' . $upload->_currentFile['name'] . ', is bigger than the ' . $upload->_maxFileSize . ' byte limit');
}
// If all systems check, do the upload
if ($upload->checkMimeType() and $upload->_imageSizeOK() and !$upload->areErrors()) {
if ($upload->_copyFile()) {
$upload->_uploadedFiles[] = $upload->_fileUploadDirectory . '/' . $upload->_getDestinationName();
}
}
$upload->_currentFile = array();
if ($upload->areErrors() and !$upload->_continueOnError) {
$errmsg = "nexform: upload function error:" . $upload->printErrors(false);
COM_errorLog($errmsg);
$GLOBALS['fe_errmsg'] = $LANG_FE_ERR['upload1'] . ':<BR>' . $upload->printErrors(false);
return false;
}
return true;
} else {
return false;
}
return false;
}
示例4: mkdir
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +-------------------------------------------------------------------------+
//
include_once $_CONF['path_system'] . 'classes/upload.class.php';
if (!file_exists($questionDir)) {
mkdir($questionDir);
chmod($questionDir, 0755);
}
$upload = new upload();
$upload->setContinueOnError(true);
$upload->setMaxFileUploads('1');
$upload->setLogFile("{$clubLogfile}");
$upload->setLogging(false);
$upload->setAllowedMimeTypes($_CONFQUIZ['allowableImageTypes']);
if (!$upload->setPath($questionDir)) {
print 'File Upload Errors:<BR>' . $upload->printErrors();
exit;
}
$upload->setMaxDimensions($_CONFQUIZ['max_upload_width'], $_CONFQUIZ['max_upload_height']);
$upload->setMaxFileSize($_CONFQUIZ['max_upload_size']);
// Set file permissions on file after it gets uploaded (number is in octet)
$upload->setPerms('0774');
$filenames = array();
$realfilenames = array();
$uploadtypes = array();
$uploadfilepos = array();
$upload->setDebug(true);
$upload->uploadFiles();
示例5: updatePage
//.........这里部分代码省略.........
}
// Delete any images if needed
for ($i = 0; $i < count($imgdelete); $i++) {
$curimage = DB_getitem($_TABLES['nexcontent_images'], "imagefile", "page_id='{$pageid}' AND imagenum='{$imgdelete[$i]}'");
$fullimage = $pageImageDir . $curimage;
if (!is_dir($fullimage) and file_exists($fullimage)) {
if (!unlink($fullimage)) {
echo COM_errorLog("Unable to delete image {$fullimage}. Please check file permissions");
$GLOBALS['statusmsg'] = "Unable to delete image {$fullimage}. Please check file permissions";
}
}
$pos = strrpos($curimage, '.');
$origimage = strtolower(substr($curimage, 0, $pos));
$ext = strtolower(substr($curimage, $pos));
$origimage .= "_original{$ext}";
$fullimage = $pageImageDir . $origimage;
if (!is_dir($fullimage) and file_exists($fullimage)) {
if (!unlink($fullimage)) {
echo COM_errorLog("Unable to delete image {$fullimage}. Please check file permissions");
$GLOBALS['statusmsg'] = "Unable to delete image {$fullimage}. Please check file permissions";
}
}
$curthumbnail = $pageImageDir . 'tn' . $curimage;
if (!is_dir($curthumbnail) and file_exists($curthumbnail)) {
if (!unlink($curthumbnail)) {
echo COM_errorLog("Unable to delete thumbnail for {$curthumbnail}. Please check file permissions");
$GLOBALS['statusmsg'] = "Unable to delete thumbnail for {$curthumbnail}. Please check file permissions";
}
}
DB_query("DELETE FROM {$_TABLES['nexcontent_images']} WHERE page_id='{$pageid}' and imagenum='{$imgdelete[$i]}'");
next($imgdelete);
}
$upload = new upload();
$upload->setLogging(false);
$upload->setDebug(false);
$upload->setLogFile($_CONF['path_log'] . 'error.log');
$upload->setMaxFileUploads($CONF_SE['max_num_images']);
if ($_CONF['image_lib'] == 'imagemagick') {
$upload->setMogrifyPath($_CONF['path_to_mogrify']);
} else {
$upload->setGDLib();
}
$upload->setAllowedMimeTypes($CONF_SE['allowableImageTypes']);
$upload->setMaxDimensions($CONF_SE['max_upload_width'], $CONF_SE['max_upload_height']);
$upload->setMaxFileSize($CONF_SE['max_uploadfile_size']);
$upload->setAutomaticResize(true);
$upload->keepOriginalImage(true);
$upload->setPerms($CONF_SE['image_perms']);
if (!$upload->setPath($pageImageDir)) {
$GLOBALS['statusmsg'] = $LANG_SE_ERR['upload1'] . ': ' . $upload->printErrors(false);
}
// OK, let's upload any pictures with this page
if (DB_count($_TABLES['nexcontent_images'], 'page_id', $pageid) > 0) {
$index_start = DB_getItem($_TABLES['nexcontent_images'], 'max(imagenum)', "page_id = '{$pageid}'") + 1;
} else {
$index_start = 1;
}
$index_start = 1;
$uniquename = time();
$filenames = array();
$imagenum = array();
for ($z = 1; $z <= $CONF_SE['max_num_images']; $z++) {
$curfile = current($_FILES);
if (!empty($curfile['name'])) {
$filenames[] = $uniquename . $z . '.jpg';
$imagenum[] = substr(key($_FILES), 9, 1);
示例6: _ff_uploadfile
function _ff_uploadfile($filename, &$upload_file, $allowablefiletypes, $use_filemgmt = 0)
{
global $_FILES, $_CONF, $_TABLES, $_FF_CONF, $LANG_GF00, $filemgmt_FileStore;
USES_class_upload();
$upload = new upload();
if ($use_filemgmt == 1) {
$upload->setPath($filemgmt_FileStore);
} else {
$upload->setPath($_FF_CONF['uploadpath']);
}
$upload->setLogging(true);
$upload->setAllowedMimeTypes($allowablefiletypes);
// Set max dimensions as well in case user is uploading a full size image
$upload->setMaxDimensions($_FF_CONF['max_uploadimage_width'], $_FF_CONF['max_uploadimage_height']);
if (!isset($_FF_CONF['max_uploadimage_size']) || $_FF_CONF['max_uploadimage_size'] == 0) {
$upload->setMaxFileSize(100000000);
} else {
$upload->setMaxFileSize($_FF_CONF['max_uploadimage_size']);
}
$upload->setAutomaticResize(true);
if (strlen($upload_file['name']) > 0) {
$upload->setFileNames($filename);
$upload->setPerms($_FF_CONF['fileperms']);
$upload->_currentFile = $upload_file;
// Verify file meets size limitations
if (!$upload->_fileSizeOk()) {
$upload->_addError('File, ' . $upload->_currentFile['name'] . ', is bigger than the ' . $upload->_maxFileSize . ' byte limit');
}
// If all systems check, do the upload
if ($upload->checkMimeType() and $upload->_imageSizeOK() and !$upload->areErrors()) {
if ($upload->_copyFile()) {
$upload->_uploadedFiles[] = $upload->_fileUploadDirectory . '/' . $upload->_getDestinationName();
}
}
$upload->_currentFile = array();
if ($upload->areErrors() and !$upload->_continueOnError) {
$errmsg = "Forum Upload Attachment Error:" . $upload->printErrors(false);
COM_errorlog($errmsg);
$GLOBALS['ff_errmsg'] = $LANG_GF00['uploaderr'] . ':<br/>' . $upload->printErrors(false);
return false;
}
return true;
} else {
return false;
}
return false;
}