Elad Meidar - Creopolis.com
2006-Dec-17 12:11 UTC
file_column error: StringIO Instead of Temp_File
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?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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
<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" />
</form>
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 Meidar - Creopolis.com"
<eize....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi all,
>
> i am usingfile_columnto 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 isnotsaved.
>
> the pictures i upload are 60x60 and there is nofile_columnvalidations
> or limitations at all.
> when uploading larger images (500x500 for ex.) it works.
>
> anyone?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---