When I do file_field within a form_for things are fine... but within a form_remote_for, with nothing else changed, I find that the params does not even have the element document[uploaded_file] even though it is definitely present in the HTML source in the form. Obviously the file upload fails. Am I missing something? Or has someone else faced this? Or is this a known bug? Rajesh --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The code difference is <% form_for :document, @document, :url => {:action => ''create'', :popup=>true}, :html => {:multipart => true}, :method => ''post'' do |f| %> <% #form_remote_for :document, @document, :update => ''content'', :url=> {:action => ''create''}, :html => {:multipart => true}, :method => ''post'' do |f| %> When the form_remote_for is commented the code works. When the form_for is commented, code bombs saying Filename cannot be blank. Regards, Rajesh On Mar 14, 5:12 pm, "K. Rajesh" <kaviraj...-uAjRD0nVeow@public.gmane.org> wrote:> When I do file_field within a form_for things are fine... but within a > form_remote_for, with nothing else changed, I find that the params > does not even have the element document[uploaded_file] even though it > is definitely present in the HTML source in the form. Obviously the > file upload fails. > > Am I missing something? Or has someone else faced this? Or is this a > known bug? > > Rajesh--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> When I do file_field within a form_for things are fine... but within a > form_remote_for, with nothing else changed, I find that the params > does not even have the element document[uploaded_file] even though it > is definitely present in the HTML source in the form. Obviously the > file upload fails. >it doesn''t really fails.. by design you cannot upload a file via ajax (security concerns). One known workaround is using a hidden frame so you can submit your form against it. There are some plugins that allow you to do that automatically. If memory serves me well, I''d say you can combine acts_as_attachment with respond_to_parent for example. Anyhow, by googling by ajax rails file upload you can propably get some more references. regards, javier ramirez -- -------- Estamos de estreno... si necesitas llevar el control de tus gastos visita http://www.gastosgem.com !!Es gratis!! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mmmm... I didnt know file uploads were not supposed to Ajax... I never thought to search that out! I was shocked thinking there was a bug in Rails. A BUG IN RAILS, I thought!!! Anyways... I got this done with just respond_to_parent. Considering that my site will host on a shared Apache, I am wondering whether it is safe to implement upload_progress plugin. In development I use Mongrel. I dont want to run into environment issues because at this time upload_progress is not a VITAL feature, it is just a nice-to- have. Thanx for the quick response, Javier. Regards, Rajesh On Mar 14, 5:36 pm, javier ramirez <jrami...-7iWCczGtl7hBDgjK7y7TUQ@public.gmane.org> wrote:> > When I do file_field within a form_for things are fine... but within a > > form_remote_for, with nothing else changed, I find that the params > > does not even have the element document[uploaded_file] even though it > > is definitely present in the HTML source in the form. Obviously the > > file upload fails. > > it doesn''t really fails.. by design you cannot upload a file via ajax > (security concerns). One known workaround is using a hidden frame so you > can submit your form against it. There are some plugins that allow you > to do that automatically. If memory serves me well, I''d say you can > combine acts_as_attachment with respond_to_parent for example. Anyhow, > by googling by ajax rails file upload you can propably get some more > references. > > regards, > > javier ramirez > > -- > -------- > Estamos de estreno... si necesitas llevar el control de tus gastos visitahttp://www.gastosgem.com!!Es gratis!!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 14 Mar 2007, at 15:04, K. Rajesh wrote:> Mmmm... I didnt know file uploads were not supposed to Ajax... I never > thought to search that out! I was shocked thinking there was a bug in > Rails. A BUG IN RAILS, I thought!!! > > Anyways... I got this done with just respond_to_parent. Considering > that my site will host on a shared Apache, I am wondering whether it > is safe to implement upload_progress plugin. In development I use > Mongrel. I dont want to run into environment issues because at this > time upload_progress is not a VITAL feature, it is just a nice-to- > have.In case you''re going to host on a shared server, I would seriously advise you to use Flash (SWFUpload in particular) for multiple file upload (with filter and max filesize) and upload progress. As a client-side technology, you don''t have to rely on serverside intricacies and it works wonderfully. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
What are the risks of using respond_to_parent? I am an absolute zero on Flash. I dont even know how to get the flash thingies on to the screen and I would rather not go into it, unless I have to have to have to. Regards, Rajesh On Mar 15, 3:38 am, Peter De Berdt <peter.de.be...-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote:> On 14 Mar 2007, at 15:04, K. Rajesh wrote: > > > Mmmm... I didnt know file uploads were not supposed to Ajax... I never > > thought to search that out! I was shocked thinking there was a bug in > > Rails. A BUG IN RAILS, I thought!!! > > > Anyways... I got this done with just respond_to_parent. Considering > > that my site will host on a shared Apache, I am wondering whether it > > is safe to implement upload_progress plugin. In development I use > > Mongrel. I dont want to run into environment issues because at this > > time upload_progress is not a VITAL feature, it is just a nice-to- > > have. > > In case you''re going to host on a shared server, I would seriously > advise you to use Flash (SWFUpload in particular) for multiple file > upload (with filter and max filesize) and upload progress. As a > client-side technology, you don''t have to rely on serverside > intricacies and it works wonderfully. > > Best regards > > Peter De Berdt--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That being said, you _do_ have to rely on a user having Flash installed and having it _enabled_. Not a huge assumption but not more safe than assuming the user has JS active and we all know that''s not a given. </cents size="two"> RSL On 3/14/07, Peter De Berdt <peter.de.berdt-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote:> > > On 14 Mar 2007, at 15:04, K. Rajesh wrote: > > Mmmm... I didnt know file uploads were not supposed to Ajax... I never > > thought to search that out! I was shocked thinking there was a bug in > > Rails. A BUG IN RAILS, I thought!!! > > > Anyways... I got this done with just respond_to_parent. Considering > > that my site will host on a shared Apache, I am wondering whether it > > is safe to implement upload_progress plugin. In development I use > > Mongrel. I dont want to run into environment issues because at this > > time upload_progress is not a VITAL feature, it is just a nice-to- > > have. > > > In case you''re going to host on a shared server, I would seriously advise > you to use Flash (SWFUpload in particular) for multiple file upload (with > filter and max filesize) and upload progress. As a client-side technology, > you don''t have to rely on serverside intricacies and it works wonderfully. > > > Best regards > > > Peter De Berdt > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 15 Mar 2007, at 15:22, Russell Norris wrote:> That being said, you _do_ have to rely on a user having Flash > installed and having it _enabled_. Not a huge assumption but not > more safe than assuming the user has JS active and we all know > that''s not a given. </cents size="two">Just like it would be a very huge assumption that a shared host would do you a favor and install or recompile a webserver because you want upload progress, right? :-) Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hwhat? I must have missed something. Why would you have to recompile the server to use upload progress? But it _would_ indeed be a huge assumption that the host would do such a favor for you. :) RSL On 3/15/07, Peter De Berdt <peter.de.berdt-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote:> > > On 15 Mar 2007, at 15:22, Russell Norris wrote: > > That being said, you _do_ have to rely on a user having Flash installed > and having it _enabled_. Not a huge assumption but not more safe than > assuming the user has JS active and we all know that''s not a given. </cents > size="two"> > > > Just like it would be a very huge assumption that a shared host would do > you a favor and install or recompile a webserver because you want upload > progress, right? :-) > > > Best regards > > > Peter De Berdt > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 15 Mar 2007, at 12:27, K. Rajesh wrote:> What are the risks of using respond_to_parent? I am an absolute zeroI didn''t get it to work back in the old days (it''s been quite a while since I''ve tried respond_to_parent), so I''m not the one you should ask :-)> on Flash. I dont even know how to get the flash thingies on to the > screen and I would rather not go into it, unless I have to have to > have to.You don''t have to know anything about Flash to use SWFUpload (http:// swfupload.mammon.se/). Just download the zip file on the site, open the javascript file and change the path to /javascripts/SWFUpload/upload.swf so that it follows rails conventions (this assumes you put the SWFUpload for in the public/javascripts/ folder of your rails app Apply the hack you find at http://blog.inquirylabs.com/2006/12/09/ getting-the-_session_id-from-swfupload/ if you need to retain your session. Include the swfupload javascript in your HTML, then put something like this in your view (and I''m doing : http://pastie.caboo.se/47116 SWFUpload will prompt the user to install flash if it''s not installed, as well as allow you to use a replacement normal file field in case Javascript is disabled. The end result can be something like this: http://www.10-forward.be/swfupload_rails.mov Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---