# Uploads with FCKEditor

**URL:** <https://www.ruby-forum.com/t/uploads-with-fckeditor/164609>\
**Category:** Rails\
**Created:** [April 3, 2009, 1:25am UTC](https://www.ruby-forum.com/t/uploads-with-fckeditor/164609 "2009-04-03T01:25:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gattone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/898d66/32.png) [@gattone](https://www.ruby-forum.com/u/gattone)\
**Post date:** [April 3, 2009, 1:25am UTC](https://www.ruby-forum.com/t/uploads-with-fckeditor/164609/1 "2009-04-03T01:25:14Z")

</div>

Hello everyone.

Since I’ve found very poor documentation about the rails FCKEditor  
plug-in and Easy-FCKEditor (which is a fork of the very same plug-in),  
I decided to bother you with my noobish questions.

I have this weird sensation that the image-uploading feature of  
FCKEditor isn’t supposed to work magically, without some sort of  
server side preparation, but I have no idea about what to do to make  
it work.

Weirdly, when I try to upload an image it gives a message saying that  
the upload was successful, but fails to show the image (and the path  
that it inserts in the editor’s ‘text area’ points to an unexistent  
uploads/images/ directory. I created this directory inside public, and  
I still can’t make it upload the image).

Also, when I try to open the file browser it shows this message:  
“unknown error creating folder”.

I’m kind of used to the abstraction level provided by rails and other  
upload plug-ins such as attachment\_fu, so i know very little about how  
to deal with this.

Any help will be apreciated.

Thanks

(I’m trying it on my development enviroment, which uses rails 2.2.2,  
but I intent to use it in my mor.ph account when in production.)

---

<div class="post-metadata">

**Author:** ![gattone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/898d66/32.png) [@gattone](https://www.ruby-forum.com/u/gattone)\
**Post date:** [April 3, 2009, 4:57am UTC](https://www.ruby-forum.com/t/uploads-with-fckeditor/164609/2 "2009-04-03T04:57:47Z")

</div>

It works. The error messages it spits back can be a little vague.

I found that I needed to change the following (my version is first)  
due to the new changes in Rails/rack/etc.

## 155c142,143 \< unless [‘ActionController::UploadedStringIO’, ‘ActionController::UploadedTempfile’, ‘Tempfile’, ‘TempFile’, ‘StringIO’].include?(file.class.to\_s)

> ```
> # RAILS_DEFAULT_LOGGER.info "CLASS OF UPLOAD OBJECT:
> 
> ```

#{file.class}"

> ```
> unless "#{file.class}" == "Tempfile" || "StringIO"
> ```

---

<div class="post-metadata">

**Author:** ![gattone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/898d66/32.png) [@gattone](https://www.ruby-forum.com/u/gattone)\
**Post date:** [April 3, 2009, 9:06am UTC](https://www.ruby-forum.com/t/uploads-with-fckeditor/164609/3 "2009-04-03T09:06:42Z")

</div>

I used fckeditor for some projects but I find that TinyMCE editor and  
rails plugin is better, for all my new rails projects now I’m using this  
plugin:

script/plugin install git://github.com/kete/tiny\_mce.git

The upload mechanism does’nt exist but if you prepare a simple  
controller/view for your upload system, the integration is really  
simple…

For example with this simple javascript included into your page you can  
control image / link / multimedia upload, in my case I have:

```
<script type='text/javascript'>
  var returnURL = "";
  var browserWindow;
  var browserFieldName;
  function fileBrowserCallBack( field_name, url, type, win ){
    if (type == "file") {
      browserUrl = "/admin/files";
    else if (type == "media") {
      browserUrl = "/admin/medias";
    } else {
      browserUrl = "/admin/images";
    }
    window.open(browserUrl, '', 

```

‘width=800,height=400,scrollbars=yes’);  
browserWindow = win;  
browserFieldName = field\_name;  
}

```
  function browserReturn(url) {
    browserWindow.document.forms[0].elements[browserFieldName].value

```

= url;  
}

---

<div class="post-metadata">

**Author:** ![gattone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/898d66/32.png) [@gattone](https://www.ruby-forum.com/u/gattone)\
**Post date:** [April 3, 2009, 10:08am UTC](https://www.ruby-forum.com/t/uploads-with-fckeditor/164609/4 "2009-04-03T10:08:16Z")

</div>

Thank you for the feedback. I’ll certainly try tinymce in a future  
project.

It turn’s out someone on the net has figured out how to make easy-  
fckeditor work properly with rails 2.2.2, and with his advice, now it  
works in my project too.

if anyone is having the same problems I was, just check this page:

[http://davidebenini.it/2009/03/23/patches-for-the-easy-fckeditor-rails-plugin/](http://davidebenini.it/2009/03/23/patches-for-the-easy-fckeditor-rails-plugin/)

On 3 abr, 04:06, Gianluca T.

---

<div class="post-metadata">

**Author:** ![gattone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/898d66/32.png) [@gattone](https://www.ruby-forum.com/u/gattone)\
**Post date:** [April 3, 2009, 10:09am UTC](https://www.ruby-forum.com/t/uploads-with-fckeditor/164609/5 "2009-04-03T10:09:26Z")

</div>

Thank you for the feedback. I’ll certainly try tinymce in a future  
project.  
It turns out someone on the net has figured out how to make easy-  
fckeditor work properly with rails 2.2.2, and with his advice, now it  
works in my project too.  
if anyone is having the same problems I was, just check this page:  
[http://davidebenini.it/2009/03/23/patches-for-the-easy-fckeditor-rail](http://davidebenini.it/2009/03/23/patches-for-the-easy-fckeditor-rail)…

On 3 abr, 04:06, Gianluca T.
