本文整理汇总了PHP中UploadFile::create_stored_filename方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadFile::create_stored_filename方法的具体用法?PHP UploadFile::create_stored_filename怎么用?PHP UploadFile::create_stored_filename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadFile
的用法示例。
在下文中一共展示了UploadFile::create_stored_filename方法的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: Note
$note = new Note();
$note->name = $focus->name;
if ($zuckerreports_config["debug"] == "yes") {
$note->description = $focus->report_output;
}
$note->filename = $focus->report_result_name;
if ($_REQUEST['parent_module'] == 'Contacts') {
$note->contact_id = $_REQUEST['parent_id'];
} else {
$note->parent_type = $_REQUEST['parent_module'];
$note->parent_id = $_REQUEST['parent_id'];
}
$note->save();
$uf = new UploadFile("upload");
$uf->set_for_soap($focus->report_result_name, file_get_contents($focus->report_result));
$uf->stored_file_name = $uf->create_stored_filename();
$uf->final_move($note->id);
$note_url = "index.php?action=DetailView&module=Notes&record=" . $note->id . "&return_module=ZuckerReports&return_action=ReportOnDemand";
}
if (!empty($_REQUEST['send_email'])) {
$mail = new SugarPHPMailer();
$emails = split(",", $_REQUEST['send_email']);
foreach ($emails as $email) {
$mail->AddAddress($email);
}
$admin = new Administration();
$admin->retrieveSettings();
if ($admin->settings['mail_sendtype'] == "SMTP") {
$mail->Mailer = "smtp";
$mail->Host = $admin->settings['mail_smtpserver'];
$mail->Port = $admin->settings['mail_smtpport'];