Hi there, Another Mongrel upload progress question... I hope you don''t mind. (see http://mongrel.rubyforge.org/docs/upload_progress.html). My problem is the following, before uploading the file I want to check if it already exists. This is done via a validation in the Myfile model: validates_uniqueness_of :filename, :scope => ''folder_id'' When I didn''t use upload progress yet this worked fine, but now the validation doesn''t get done until after the file is uploaded. Obviously this is behaviour I don''t want. It seems the progress starts before anything else because of the following in the config file :in_front => true. Is there anyway to do this validation before starting the upload progress? At the moment I''m clueless... Thanks!! Mischa. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 Nov 27, 2006, at 3:33 PM, Mischa Berger wrote:> > Hi there, > > Another Mongrel upload progress question... I hope you don''t mind. > (see http://mongrel.rubyforge.org/docs/upload_progress.html). > > My problem is the following, before uploading the file I want to check > if it already exists. This is done via a validation in the Myfile > model: > > validates_uniqueness_of :filename, :scope => ''folder_id'' > > When I didn''t use upload progress yet this worked fine, but now the > validation doesn''t get done until after the file is uploaded. > Obviously > this is behaviour I don''t want. It seems the progress starts before > anything else because of the following in the config file :in_front => > true. Is there anyway to do this validation before starting the upload > progress? At the moment I''m clueless... > > Thanks!! > > Mischa.Hey Mischa- The mongrel upload progress has to be in_front => true to work. That is the only way for it to know the status of the upload. Mongrel keeps an internal progress updater going and tells the upload progress handler to increment the progress bar in the browser. But control doesn''t come to your rails app until after the entire upload is done. AFAIK there is no easy way to do the validation you want to do before the prorgess bar is done and the file is already uploaded :/ Cheers- -- Ezra Zygmuntowicz -- Lead Rails Evangelist -- ez-NLltGlunAUd/unjJdyJNww@public.gmane.org -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks for the feedback. Now I''m thinking of using Ajax to do the check after the file to upload has been selected and before the upload button has been clicked. Does anyone have experience with this? Is this possible? Thanks, Mischa.> is done. AFAIK there is no easy way to do the validation you want to > do before the prorgess bar is done and the file is already uploaded :/-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---