Skip to content

Instantly share code, notes, and snippets.

@mogetutu
Last active January 19, 2016 22:01
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mogetutu/5653046 to your computer and use it in GitHub Desktop.
Save mogetutu/5653046 to your computer and use it in GitHub Desktop.

Have a writable folder public/blog_images in you app.

###routes.php

// Redactor Blog Upload
Route::post('redactorUpload', function()
{
    $file = Input::file('file');
    $fileName = $file->getClientOriginalName();
    
    $file->move(public_path().'/blog_images', $fileName);
    return Response::json(array('filelink' => '/blog_images/' . $fileName));
});

###redactor-js.js

<script type="text/javascript">
    $(function() {
        $('#blog').redactor({
            imageUpload: '/redactorUpload'
        });
     });
</script>

###textarea definition

<div class="control-group">
     <textarea name="body" id="blog"></textarea>
</div>
@odyright
Copy link

don't we need to have model "blog_images" ? and what are the full config for integrating redactor in laravel 4?

@kampit
Copy link

kampit commented Feb 20, 2014

How to validate csrf token in .redactor()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment