Forum: Ruby on Rails file_column error: StringIO Instead of Temp_File

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Elad M. (Guest)
on 2006-12-31 01:36
(Received via mailing list)
Hi all,

i am using file_column to upload 3 images from the same form, they are
all different names and DOM IDs so there isn't a problem with the
multiple upload.
The problem is when i try to upload a file (or 2, or 3) sometimes it
works, but sometimes i get this in the log file:

"bar_image"=>{"file_temp"=>"", "file"=>#<StringIO:0xb4b08268>}

and the picture is not saved.

the pictures i upload are 60x60 and there is no file_column validations
or limitations at all.
when uploading larger images (500x500 for ex.) it works.

ivor (Guest)
on 2007-02-01 11:22
(Received via mailing list)
I am getting a similar problem.

I did an svn install of file_column in my vendor directory,

I have the following code in my model:

class FileUpload < ActiveRecord::Base
  file_column :path

"path" is :text db is mysql

in my controller:
  def do_upload_file
    fileRecord = => params[:path])
    redirect_to :action => index

in the view:
<%= form_tag ({:action => 'do_upload_file'}, {:multipart => true})%>

    <%= file_column_field "file_upload", "path" %>
    <%= submit_tag "upload" %>
<%= end_form_tag %>

The resulting html is

<form action="/info_upload/do_upload_file" enctype="multipart/form-
data" method="post">

    <input id="file_upload_path_temp" name="file_upload[path_temp]"
type="hidden" /><input id="file_upload_path" name="file_upload[path]"
size="30" type="file" />
    <input name="commit" type="submit" value="upload" />

That is exactly what I did and nothing else.
When I upload the image the path field in the db is an empty string.
It used to NULL but then I changed the column to be not null. The /
path/tmp directory is created but there is no file in it.

I am guessing I am doing something really stupid because the plugin
seems to work fine out of the box for most people.

Would appreciate any help.


On Dec 17 2006, 2:11 pm, "Elad M. -"
This topic is locked and can not be replied to.