当前位置: 首页>>代码示例>>PHP>>正文


PHP UploadFile::get_upload_error方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:27,代码来源:Email.php

示例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;
         }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:31,代码来源:upload.php


注:本文中的UploadFile::get_upload_error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。