need help with approach for application backend

Hi! At this time i work with backend for my application. In the backend i will provide for user the ability to create and edit documents which contains images. According to this goal i think about 1) what is a good way to implement images uploading to server according my needs (described below) 2) how to implement UI for this part of backend so that it was convenient for user to upload images and view/browse through previously uploaded images 2) how to implement images inserting into document (documents are created using some free wisiwig editor)

This image illustrates how can backend look to me

Yesterday i tried the combination FileColumn + TinyMCE. I think, that images will be stored on server in place public/images/users/user_id/image_file1, image_file2 ... and so on, so that every user has its own folder with images. I've played with FileColumn, and got this: when i upload file, its stored in right place - public/images/users/user_id/ (for this i have to edit file_column.rb), but when i upload next image, previous image is deleted. In sql table "documents" i have 2 columns, "image" and "image1", so that there must be ability to store 2 images in user_id folder, and the records in columns "image" and "image1" must point to these images (if i understand the concept of FileColumn right).

And the problem with TinyMCE - user must provide URL (http://) to image, user can't point image "browse" way, as usual. Therefore in backend i need to show images full URL, so user can copy and paste it. This all seems to be a bad approach.

If you had similar goals and/or have experience how to achieve this, i appreciate if you share your knowledge or point me to article/design pattern related to my needs.

It would be good, if there is something like YUI , but which copes well with the backend tasks.