Unisharp laravel 文件管理器 NotFoundHttpException

Posted

技术标签:

【中文标题】Unisharp laravel 文件管理器 NotFoundHttpException【英文标题】:Unisharp laravel file manager NotFoundHttpException 【发布时间】:2017-09-14 06:06:11 【问题描述】:

请帮助我了解 unisharp laravel 文件管理器。我的 Laravel 5.4.36 和 tinymce-4.6.6 版本 我只是按照说明进行操作,但尝试了其他方法,例如将Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class, 放在Intervention\Image\ImageServiceProvider::class, 的顶部.. 但仍然有这个错误......

有没有人可以帮帮我?..

非常感谢

【问题讨论】:

【参考方案1】:

我只使用选项 2:TinyMCE4

然后将path_absolute : "/", 更改为path_absolute : " URL::to('/') /",

基本上这是我的全部代码...

@extends('layouts.app')

@section('content')
<div class="container top-space">
    <div class="row" >
        <div class="container weldiv">
            <span class="welcomeh1">Add Article and Announcement</span>
        </div>
    </div>
    <div class="row top-space">
        <div class="container weldiv">
            <div class="col-md-9 col-md-offset-1">
                <form class="form-horizontal" role="form" method="POST" action=" route('add_article_announcement.post') ">
                     csrf_field() 
                    <div class="form-group $errors->has('article_title') ? ' has-error' : '' ">
                        <label for="article_title" class="col-md-4 control-label">Article Title</label>
                        <div class="col-md-6">
                            <input id="article_title" type="text" class="form-control" name="article_title" value=" old('article_title') " required autofocus>
                            @if ($errors->has('article_title'))
                                <span class="help-block">
                                    <strong> $errors->first('article_title') </strong>
                                </span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group $errors->has('article_content') ? ' has-error' : '' ">
                        <label for="article_content" class="col-md-4 control-label">Article Content</label>
                        <div style="padding: 10px">

                            <textarea name="article_content" class="form-control my-editor">!! old('article_content') !!</textarea>
                            @if ($errors->has('article_content'))
                                <span class="help-block">
                                    <strong> $errors->first('article_content') </strong>
                                </span>
                            @endif
                        </div>
                    </div>
                    @if(session()->has('message'))
                            <div class="alert alert-success">
                                 session()->get('message') 
                            </div>
                        @endif
                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary">
                                    Submit
                                </button>
                                <a href='' class="btn btn-primary">
                                    Cancel
                                </a>
                            </div>
                        </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
  var editor_config = 
    path_absolute : " URL::to('/') /",
    selector: "textarea.my-editor",
    plugins: [
      "advlist autolink lists link image charmap print preview hr anchor pagebreak",
      "searchreplace wordcount visualblocks visualchars code fullscreen",
      "insertdatetime media nonbreaking save table contextmenu directionality",
      "emoticons template paste textcolor colorpicker textpattern"
    ],
    toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media",
    relative_urls: false,
    file_browser_callback : function(field_name, url, type, win) 
      var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
      var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight;

      var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name=' + field_name;
      if (type == 'image') 
        cmsURL = cmsURL + "&type=Images";
       else 
        cmsURL = cmsURL + "&type=Files";
      

      tinyMCE.activeEditor.windowManager.open(
        file : cmsURL,
        title : 'Filemanager',
        width : x * 0.8,
        height : y * 0.8,
        resizable : "yes",
        close_previous : "no"
      );
    
  ;

  tinymce.init(editor_config);
</script>

@endsection

【讨论】:

以上是关于Unisharp laravel 文件管理器 NotFoundHttpException的主要内容,如果未能解决你的问题,请参考以下文章

用于 laravel 问题的 unisharp 文件管理器

UniSharp 文件管理器不适用于 Laravel 7

在页面内显示 UniSharp/laravel-filemanager(无编辑器)

unisharp 文件管理器不适用于 laravel 5.6

Laravel UniSharp 文件管理器已上传,但未显示图像

Laravel 文件管理器 UniSharp 不正确的图像 URL