本文整理汇总了PHP中UploadFile::get_upload_error方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadFile::get_upload_error方法的具体用法?PHP UploadFile::get_upload_error怎么用?PHP UploadFile::get_upload_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadFile
的用法示例。
在下文中一共展示了UploadFile::get_upload_error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: email2saveAttachment
/**
* Presaves one attachment for new email 2.0 spec
* DOES NOT CREATE A NOTE
* @return string ID of note associated with the attachment
*/
public function email2saveAttachment()
{
$email_uploads = "modules/Emails/{$GLOBALS['current_user']->id}";
$upload = new UploadFile('email_attachment');
if (!$upload->confirm_upload()) {
$err = $upload->get_upload_error();
if ($err) {
$GLOBALS['log']->error("Email Attachment could not be attached due to error: {$err}");
}
return array();
}
$guid = create_guid();
$fileName = $upload->create_stored_filename();
$GLOBALS['log']->debug("Email Attachment [{$fileName}]");
if ($upload->final_move($guid)) {
copy("upload://{$guid}", sugar_cached("{$email_uploads}/{$guid}"));
return array('guid' => $guid, 'name' => $GLOBALS['db']->quote($fileName), 'nameForDisplay' => $fileName);
} else {
$GLOBALS['log']->debug("Email Attachment [{$fileName}] could not be moved to upload dir");
return array();
}
}
示例2: urldecode
}
}
}
$base_filename = urldecode($tempFile);
} else {
$upload = new UploadFile('upgrade_zip');
/* Bug 51722 - Cannot Upload Upgrade File if System Settings Are Not Sufficient, Just Make sure that we can
upload no matter what, set the default to 60M */
global $sugar_config;
$upload_maxsize_backup = $sugar_config['upload_maxsize'];
$sugar_config['upload_maxsize'] = 60000000;
/* End Bug 51722 */
if (!$upload->confirm_upload()) {
logThis('ERROR: no file uploaded!');
echo $mod_strings['ERR_UW_NO_FILE_UPLOADED'];
$error = $upload->get_upload_error();
// add PHP error if isset
if ($error) {
$out = "<b><span class='error'>{$mod_strings['ERR_UW_PHP_FILE_ERRORS'][$error]}</span></b><br />";
}
} else {
$tempFile = "upload://" . $upload->get_stored_file_name();
if (!$upload->final_move($tempFile)) {
logThis('ERROR: could not move temporary file to final destination!');
unlinkUWTempFiles();
$out = "<b><span class='error'>{$mod_strings['ERR_UW_NOT_VALID_UPLOAD']}</span></b><br />";
} else {
logThis('File uploaded to ' . $tempFile);
$base_filename = urldecode(basename($tempFile));
$perform = true;
}