saifulapm's avatar

Redactor image uploading not working in Laravel 5 [ working Laravel 4 ]

I am updating my CMS to laravel 5 from Laravel 4. But redactor image uploading not working . Here All code:

This is Route for Image Upload

//Redactor Image Upload
Route::post('image/upload', function(){
    $image = Request::file('file');
    $filename = 'bdtimes'.rand(10, 99999999).'.'.$image->getClientOriginalExtension();
    $move = Image::make($image->getRealPath())->save('uploads/images/original/'.$filename);

    if($move){

        return Response::json(['filelink'=>'/uploads/images/original/'. $filename]);
    }else{
        return Response::json(['error'=>true]);
    }
});

This is Script of Redactor:

$(function()
{
    $('#redactor').redactor({
            focus: true,
            imageUpload: '{{ url() }}/image/upload',
            imageManagerJson: '{{ url() }}/image.php',
            plugins: ['table', 'video','imagemanager','fontcolor','fontsize','fullscreen'],
            maxHeight: 300,
            minHeight: 300
        });
});

N.B. This is working well in laravel 4.

0 likes
1 reply

Please or to participate in this conversation.