本文整理汇总了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');
示例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) {