我不知道发生了什么事 我无法在Yii2上通过ckeditor和Kcfinder上传文件 Yii2高级表格
我收到以下警告信息:
10.jpg:上传的文件超过64MB字节。 (screenshot)
文件php.ini
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads=On
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
upload_tmp_dir="C:\xampp\tmp"
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize=64MB
; Maximum number of files that can be uploaded via a single request
max_file_uploads=10
post_max_size=64M
文件后端\ views \ information \ _form.php
<?php
namespace backend\modules;
use yii\helpers\ArrayHelper;
use iutbay\yii2kcfinder\KCFinderAsset;
class CKEditor extends \dosamigos\ckeditor\CKEditor
{
public $enableKCFinder = true;
/**
* Registers CKEditor plugin
*/
protected function registerPlugin()
{
if ($this->enableKCFinder)
{
$this->registerKCFinder();
}
parent::registerPlugin();
}
/**
* Registers KCFinder
*/
protected function registerKCFinder()
{
$register = KCFinderAsset::register($this->view);
$kcfinderUrl = $register->baseUrl;
$browseOptions = [
'filebrowserBrowseUrl' => $kcfinderUrl . '/browse.php?opener=ckeditor&type=files',
'filebrowserUploadUrl' => $kcfinderUrl . '/upload.php?opener=ckeditor&type=files',
];
$this->clientOptions = ArrayHelper::merge($browseOptions, $this->clientOptions);
}
}
文件后端\ modules \ ckeditor.php
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use backend\models\Menulist;
//use dosamigos\ckeditor\CKEditor;
use backend\modules\CKEditor;
use iutbay\yii2kcfinder\KCFinder;
use yii\helpers\Url;
// kcfinder options
// http://kcfinder.sunhater.com/install#dynamic
$kcfOptions = array_merge(KCFinder::$kcfDefaultOptions, [
'uploadURL' => Yii::getAlias('@web').'/upload',
'access' => [
'files' => [
'upload' => true,
'delete' => false,
'copy' => false,
'move' => false,
'rename' => false,
],
'dirs' => [
'create' => true,
'delete' => false,
'rename' => false,
],
],
]);
// Set kcfinder session options
Yii::$app->session->set('KCFINDER', $kcfOptions);
/* @var $this yii\web\View */
/* @var $model backend\models\Information */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="information-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'menulist_id')->dropDownList(
ArrayHelper::map(Menulist::find()->all(),'id','menulist_name'),
['prompt'=>'Select Menulist']
) ?>
<?= $form->field($model, 'information_detail')->widget(CKEditor::className(), [
'options' => ['rows' => 6],
'preset' => 'full'
]) ?>
<?= $form->field($model, 'information_status')->dropDownList([ 'active' => 'Active', 'inactive' => 'Inactive', ], ['prompt' => 'Status']) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>