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


PHP Functions::fileUploadErrorText方法代码示例

本文整理汇总了PHP中Fisharebest\Webtrees\Functions\Functions::fileUploadErrorText方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions::fileUploadErrorText方法的具体用法?PHP Functions::fileUploadErrorText怎么用?PHP Functions::fileUploadErrorText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fisharebest\Webtrees\Functions\Functions的用法示例。


在下文中一共展示了Functions::fileUploadErrorText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

     FlashMessages::addMessage(I18N::translate('No media file was provided.'));
     break;
 } else {
     $fileName = $filename;
 }
 // Now copy the file to the correct location.
 if (!empty($_FILES['mediafile']['name'])) {
     $serverFileName = WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName . $fileName;
     if (file_exists($serverFileName)) {
         FlashMessages::addMessage(I18N::translate('The file %s already exists. Use another filename.', $folderName . $fileName));
         break;
     }
     if (move_uploaded_file($_FILES['mediafile']['tmp_name'], $serverFileName)) {
         Log::addMediaLog('Media file ' . $serverFileName . ' uploaded');
     } else {
         FlashMessages::addMessage(I18N::translate('There was an error uploading your file.') . '<br>' . Functions::fileUploadErrorText($_FILES['mediafile']['error']));
         break;
     }
     // Now copy the (optional) thumbnail
     if (!empty($_FILES['thumbnail']['name']) && preg_match('/^image\\/(png|gif|jpeg)/', $_FILES['thumbnail']['type'], $match)) {
         // Thumbnails have either
         // (a) the same filename as the main image
         // (b) the same filename as the main image - but with a .png extension
         if ($match[1] == 'png' && !preg_match('/\\.(png)$/i', $fileName)) {
             $thumbFile = preg_replace('/\\.[a-z0-9]{3,5}$/', '.png', $fileName);
         } else {
             $thumbFile = $fileName;
         }
         $serverFileName = WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName . $thumbFile;
         if (move_uploaded_file($_FILES['thumbnail']['tmp_name'], $serverFileName)) {
             Log::addMediaLog('Thumbnail file ' . $serverFileName . ' uploaded');
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:31,代码来源:addmedia.php

示例2: header

     return;
 case 'replace_upload':
     $gedcom_id = Filter::postInteger('gedcom_id');
     $keep_media = Filter::post('keep_media', '1', '0');
     $GEDCOM_MEDIA_PATH = Filter::post('GEDCOM_MEDIA_PATH');
     $WORD_WRAPPED_NOTES = Filter::post('WORD_WRAPPED_NOTES', '1', '0');
     $tree = Tree::findById($gedcom_id);
     if (Filter::checkCsrf() && $tree) {
         $tree->setPreference('keep_media', $keep_media);
         $tree->setPreference('GEDCOM_MEDIA_PATH', $GEDCOM_MEDIA_PATH);
         $tree->setPreference('WORD_WRAPPED_NOTES', $WORD_WRAPPED_NOTES);
         if (isset($_FILES['tree_name'])) {
             if ($_FILES['tree_name']['error'] == 0 && is_readable($_FILES['tree_name']['tmp_name'])) {
                 $tree->importGedcomFile($_FILES['tree_name']['tmp_name'], $_FILES['tree_name']['name']);
             } else {
                 FlashMessages::addMessage(Functions::fileUploadErrorText($_FILES['tree_name']['error']), 'danger');
             }
         } else {
             FlashMessages::addMessage(I18N::translate('No GEDCOM file was received.'), 'danger');
         }
     }
     header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
     return;
 case 'replace_import':
     $basename = basename(Filter::post('tree_name'));
     $gedcom_id = Filter::postInteger('gedcom_id');
     $keep_media = Filter::post('keep_media', '1', '0');
     $GEDCOM_MEDIA_PATH = Filter::post('GEDCOM_MEDIA_PATH');
     $WORD_WRAPPED_NOTES = Filter::post('WORD_WRAPPED_NOTES', '1', '0');
     $tree = Tree::findById($gedcom_id);
     if (Filter::checkCsrf() && $tree) {
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:admin_trees_manage.php


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