File_column error: StringIO Instead of Temp_File


#1

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.

anyone?


#2

Hi.
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
end

“path” is :text db is mysql

in my controller:
def do_upload_file
fileRecord = FileUpload.new(:path => params[:path])
fileRecord.save
redirect_to :action => index
end

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

<input id="file_upload_path_temp" name="file_upload[path_temp]"

type=“hidden” />

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.

Regards
Ivor

On Dec 17 2006, 2:11 pm, “Elad M. - Creopolis.com