Create FileColumn Image without a From


im creating a new bookmark with a form and i'm uploading an image with
File Column. This works well!

But another function is to copy this bookmark. That means it will be
created a new Object, with an new Id. All the other attributes should
be copied from the original. That works, but not with the "image"
attribute. Thats where the fileColumn Image is placed. Im getting the

'Do not know how to handle a string with value '/path/Bild_4.jpg'

I think fileColumn expects an File, and not an string url. But i don't
know to solve this Problem :frowning:

Here is my Code:

@bookmark = => oldBookmark.title,
                             :url => oldBookmark.url,
                             :description => oldBookmark.description,
                             :confirmed => 0,
                             :user =>User.find(session[:user]),
                             :image => oldBookmark.image )

Maybe someone has an idea? Thanks a lot!

I’m not sure what you mean fully, but I think you mean save an item from the FS or URL…not uploaded via a form
here is an example from when I used a FileColumn to upload an image to my database using a URL (it is 2 years old and very ugly code)
essentially in your case just treat your string as I do the URL
in environment.rb have:
require ‘ftools’
require ‘fileutils’
and in your controller something like

raise if not orig =~ /^(http|https)://[a-z0-9]+([-.]{1}[a-z0-9]+).[a-z]{2,5}(([0-9]{1,5})?/.)?$/ix
logger.error “??? VALUE >> #{orig}”
response = false
#if good url format, get the file
tn = open(orig)
filename = orig.split("/")

      tp = tn.path
      nf =
      nf_path = File.split(nf.path)
      f = "#{nf_path[0]}" << "/" << "#{filename.last}"
      #dreamhost is case sensitive, this is for URL's only
      f = f.downcase
      logger.error "FFFFFFFFFFF  #{f}"
      FileUtils.touch f

      #sleep 2
      ff ="#{f}")
      FileUtils.copy nf.path, ff.path
      @tile.img_name = #gold
      if response == false
        logger.error "???????????? BAD URL >> #{orig}"
  #if orig is empty
  logger.error "ZZZZZZZZZZZZZZZZZZZ NO URL >> #{orig}"

#if both img fields are empty: upload a default img (for now)
if @tile.img_name.nil?
  #@tile.img_name = + "/public/images/rails.png") #gold default if they do not upload a file
  logger.error "???????????? no FILE"
  if @tile.img_path.empty? or response == false
    @tile.img_name = + "/public/images/default.jpg") #gold default if they do not upload a file
    logger.error "???????????? no URL"

#email admin about new tile
    if session[:user].login == "anonymous"
      redirect_to :controller => '/user/logout'
      redirect_to :controller => '/user/account/'
    render :action => 'index'  #should go back to upload_tile

checkout working example at

no login required