zaid
November 5, 2007, 12:00pm
1
Hola
Estoy intentando subir imágenes a traves de rmagick y ajax y no consigo
q funcione. Sin ajax funciona correctamente.
rhtml
<% form_remote_for :photo, :update => “main_content”, :url =>
{:controller => “photos”, :action => “create”, :tID =>
params[:tID] },
:html => { :multipart => true } do |form| %>
<%= image_submit_tag ("../images/aceptar.gif") %>
<% end -%>
modelo
class EstablishmentPhoto < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :file_system,
:size => 0.bytes…2.megabytes,
:resize_to => ‘640x480>’,
:path_prefix => “public”,
:thumbnails => { :thumb => ‘100x100’ },
:processor => :Rmagick
validates_as_attachment
end
controller
@e_photo = EstablishmentPhoto.new(params[:e_photo])
if @e_photo.save
flash[:errorlogo] = 'Su logo se ha subido correctamente.'
cerrar
else
flash[:errorlogo] = 'ERROR.'
render :action => 'list'
end
Log
undefined method `content_type’ for “c:\PC030031.JPG”:String
En la base de datos tiene definido un campo como como varchar(100). Y
sin el ajax me ha estado funcionando sin problemas…
Alguien sabe pq puede ser?? Me estoy volviendo loco
Muchas gracias
zaid
November 5, 2007, 12:09pm
2
DavicÃn … escribió:
Hola
Estoy intentando subir imágenes a traves de rmagick y ajax y no consigo
q funcione. Sin ajax funciona correctamente.
No es posible hacer upload mediante ajax puro y duro, aquà tienes un
artÃculo que indica cómo simular ajax al subir archivos:
My friends often asked me how to upload file using AJAX, and usually they got answer "in no way". Correct answer, but what if I need to upload file without full page reloading? And, of course, I want to use RJS in this case. Here I'll explain what to...
zaid
November 5, 2007, 12:30pm
3
zaid
November 5, 2007, 7:37pm
4
Raul M. wrote:
No es posible hacer upload mediante ajax puro y duro, aquà tienes un
artÃculo que indica cómo simular ajax al subir archivos:
In-place file upload with Ruby on Rails | Dmytro Shteflyuk's Home
He leÃdo el artÃculo y ya subo los ficheros. El problema que tengo ahora
es que no se como recargar la página.
Cuando termina el alta le mando a:
redirect_to :action => 'list
Pero no me recarga la página :((
SabeÃs cómo se puede hacer??
Muchas gracias