How to capture an image that I want to insert in the editor Froala, using larvel

0

Create the url waiting for the image but in the request I do not get something that I can read. View:

<div class="row" id="form38">
                            <div class="col">
                                <textarea class="selector" id="my_editor" name="reportage" id="ckeditor" required></textarea>
                            </div>
                        </div>

<script>
        var APP_URL = {!!json_encode(url('/'))!!};
        $(function() {
        $('.selector').froalaEditor({

            requestWithCORS: false,
            imageUploadParams: {id: 'my_editor'},
            imageMove: true,
            imageUpload: true,
            imageUploadURL: '/imagenes_editor',
            imageUploadMethod: 'GET',
            imageUploadRemoteUrls: true,
            imageUploadParam: 'Imagen',
            imageManagerLoadURL:'/imagenes_editor',
             imageAllowedTypes: ['jpeg', 'jpg', 'png']
             })
            .on('froalaEditor.image.beforeUpload', function (e, editor, images) {
              alert(JSON.stringify(e));


                }).on('froalaEditor.image.uploaded', function (e, editor, response) {
            });
    });
    </script>

I'm placing the punctual code lines. controller:

public function subirimagen(Request $request)
    {

        dd($request);
        $image = $request->file('Imagen');


        $destination = 'uploads/notes/';

        if (!empty($image)) {
            $filename = $image->getClientOriginalName();
            $image->move($destination, $filename);

            return response()->json(["link"=>$destination.$filename],200);
        }else{
            $filename = '';
            return response()->json(["link"=>'joel'],200);
        }

    }

and the route you create to wait for the image is:

Route::get('/imagenes_editor', ['as'=>'imagenes_editor','uses'=>'NotesController@subirimagen']);

I print the request:

Request {#42
  #json: null
  #convertedFiles: null
  #userResolver: Closure {#195
    class: "Illuminate\Auth\AuthServiceProvider"
    this: AuthServiceProvider {#41 …}
    parameters: {
      $guard: {
        default: null
      }
    }
    use: {
      $app: Application {#2 …}
    }
    file: "/run/media/joel/8e19e26e-44c4-4d87-b32f-11b5fc61cf4b/guillermo/boda/bodas/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php"
    line: "85 to 87"
  }
  #routeResolver: Closure {#197
    class: "Illuminate\Routing\Router"
    this: Router {#25 …}
    use: {
      $route: Route {#161 …}
    }
    file: "/run/media/joel/8e19e26e-44c4-4d87-b32f-11b5fc61cf4b/guillermo/boda/bodas/vendor/laravel/framework/src/Illuminate/Routing/Router.php"
    line: "628 to 630"
  }
  +attributes: ParameterBag {#44
    #parameters: []
  }
  +request: ParameterBag {#50
    #parameters: []
  }
  +query: ParameterBag {#50}
  +server: ServerBag {#46
    #parameters: array:23 [
      "DOCUMENT_ROOT" => "/run/media/joel/8e19e26e-44c4-4d87-b32f-11b5fc61cf4b/guillermo/boda/bodas/public"
      "REMOTE_ADDR" => "127.0.0.1"
      "REMOTE_PORT" => "53998"
      "SERVER_SOFTWARE" => "PHP 7.0.25 Development Server"
      "SERVER_PROTOCOL" => "HTTP/1.1"
      "SERVER_NAME" => "127.0.0.1"
      "SERVER_PORT" => "8000"
      "REQUEST_URI" => "/imagenes_editor"
      "REQUEST_METHOD" => "GET"
      "SCRIPT_NAME" => "/index.php"
      "SCRIPT_FILENAME" => "/run/media/joel/8e19e26e-44c4-4d87-b32f-11b5fc61cf4b/guillermo/boda/bodas/public/index.php"
      "PATH_INFO" => "/imagenes_editor"
      "PHP_SELF" => "/index.php/imagenes_editor"
      "HTTP_HOST" => "localhost:8000"
      "HTTP_CONNECTION" => "keep-alive"
      "HTTP_USER_AGENT" => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 OPR/42.0.2393.94"
      "HTTP_ACCEPT" => "*/*"
      "HTTP_REFERER" => "http://localhost:8000/administrate/notes/create"
      "HTTP_ACCEPT_ENCODING" => "gzip, deflate, lzma, sdch, br"
      "HTTP_ACCEPT_LANGUAGE" => "es-419,es;q=0.8"
      "HTTP_COOKIE" => "XSRF-TOKEN=eyJpdiI6InV0ZnZKajgwUFllXC83VVJ6UDV6RXlRPT0iLCJ2YWx1ZSI6IkorQks5SE1LckI0XC9cL3hrY1M2c3dGK0hGM2VWbHllQ0VOZUxGTlVMeWkzQzEwdnV5bmttNGtGRVFcLzBkeHdzdVplN004eW5mUHZ6OStsVnRYTEVUclpnPT0iLCJtYWMiOiIwMmRhYjMwNzQ1NjUwOGJmNWJmOTM4MWM5N2IwMjFkZjIwZjQyMjM5Y2ZlMzRjYzgyMDE4MGI0YmQ4ODNjMGQ5In0%3D; laravel_session=eyJpdiI6Ik53NU16VjFiRm82eW9Ub2hmd3RuM1E9PSIsInZhbHVlIjoibVV3a2dtNlhISmR0cjIwUHFtU3dlQURPMUhJNHNPMkZPTGFZYlQ0cHA2UlB6YnZvRDkyU1lXTEtzYmhkSHVCbyt1aGdYaFBSRTh0cHFKNXdaXC9LM1h3PT0iLCJtYWMiOiIxYzUyMDc3ZmJjYjY4ZjNkYTc2NjMyNmFmNzNkOTBhYjQ5MDNiZGNlNDgwYWVhOWYzODA4NjdkMWFiMzA4YjU1In0%3D"
      "REQUEST_TIME_FLOAT" => 1528469837.3577
      "REQUEST_TIME" => 1528469837
    ]
  }
  +files: FileBag {#47
    #parameters: []
  }
  +cookies: ParameterBag {#45
    #parameters: array:2 [
      "XSRF-TOKEN" => "yGSX4c9bIMY0LYxCgIUFlSXfdiRoLxKF6entSyPp"
      "laravel_session" => "VwrAd18B7WZg3mTjRhvaoYe47Uo87cFpWHLSshB7"
    ]
  }
  +headers: HeaderBag {#48
    #headers: array:8 [
      "host" => array:1 [
        0 => "localhost:8000"
      ]
      "connection" => array:1 [
        0 => "keep-alive"
      ]
      "user-agent" => array:1 [
        0 => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 OPR/42.0.2393.94"
      ]
      "accept" => array:1 [
        0 => "*/*"
      ]
      "referer" => array:1 [
        0 => "http://localhost:8000/administrate/notes/create"
      ]
      "accept-encoding" => array:1 [
        0 => "gzip, deflate, lzma, sdch, br"
      ]
      "accept-language" => array:1 [
        0 => "es-419,es;q=0.8"
      ]
      "cookie" => array:1 [
        0 => "XSRF-TOKEN=eyJpdiI6InV0ZnZKajgwUFllXC83VVJ6UDV6RXlRPT0iLCJ2YWx1ZSI6IkorQks5SE1LckI0XC9cL3hrY1M2c3dGK0hGM2VWbHllQ0VOZUxGTlVMeWkzQzEwdnV5bmttNGtGRVFcLzBkeHdzdVplN004eW5mUHZ6OStsVnRYTEVUclpnPT0iLCJtYWMiOiIwMmRhYjMwNzQ1NjUwOGJmNWJmOTM4MWM5N2IwMjFkZjIwZjQyMjM5Y2ZlMzRjYzgyMDE4MGI0YmQ4ODNjMGQ5In0%3D; laravel_session=eyJpdiI6Ik53NU16VjFiRm82eW9Ub2hmd3RuM1E9PSIsInZhbHVlIjoibVV3a2dtNlhISmR0cjIwUHFtU3dlQURPMUhJNHNPMkZPTGFZYlQ0cHA2UlB6YnZvRDkyU1lXTEtzYmhkSHVCbyt1aGdYaFBSRTh0cHFKNXdaXC9LM1h3PT0iLCJtYWMiOiIxYzUyMDc3ZmJjYjY4ZjNkYTc2NjMyNmFmNzNkOTBhYjQ5MDNiZGNlNDgwYWVhOWYzODA4NjdkMWFiMzA4YjU1In0%3D"
      ]
    ]
    #cacheControl: []
  }
  #content: null
  #languages: null
  #charsets: null
  #encodings: null
  #acceptableContentTypes: null
  #pathInfo: "/imagenes_editor"
  #requestUri: "/imagenes_editor"
  #baseUrl: ""
  #basePath: null
  #method: "GET"
  #format: null
  #session: Store {#265
    #id: "VwrAd18B7WZg3mTjRhvaoYe47Uo87cFpWHLSshB7"
    #name: "laravel_session"
    #attributes: array:4 [
      "_token" => "yGSX4c9bIMY0LYxCgIUFlSXfdiRoLxKF6entSyPp"
      "_previous" => array:1 [
        "url" => "http://localhost:8000/imagenes_editor"
      ]
      "_flash" => array:2 [
        "old" => []
        "new" => []
      ]
      "login_web_59ba36addc2b2f9401580f014c7f58ea4e30989d" => 3
    ]
    #handler: FileSessionHandler {#266
      #files: Filesystem {#94}
      #path: "/run/media/joel/8e19e26e-44c4-4d87-b32f-11b5fc61cf4b/guillermo/boda/bodas/storage/framework/sessions"
      #minutes: "120"
    }
    #started: true
  }
  #locale: null
  #defaultLocale: "en"
  -isHostValid: true
  -isForwardedValid: true
  basePath: ""
  format: "html"
}

then I do not know how to capture

    
asked by developer 08.06.2018 в 17:02
source

0 answers