Alright this one''s tricky - don''t shy off! I''ve setup a multi-file uploader with Rails 3 + paperclip + Ajax Upload (http://valums.com/ajax-upload/) My controller is as follows (which works): def upload @photoalbum = PhotoAlbum.create @photo = @photoalbum.photos.create({ :photo => params[:file], :title => params[:filename], :description => "Uploaded on #{Date.today.strftime("%b %d, %Y")}" }) respond_to do |format| format.json end end The big issue here. is that if a User uploads 3 files, they are all going to seperate albums. Rails uploads the 3 files, and each file has it''s own uniquely added album. That''s bad. I need all the files uploaded in a batch to go to it''s own album.. Any thoughts on how to solve for this? In the AJAX upload it is possible to pass a param. I thought about passing an album ID, problem is that would lead to a lot of blank albums, as the user doesn''t always upload photos. Geniuses wanted! thank you -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hm.. Do you think you could post your view too? On Oct 23, 5:48 pm, nobosh <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Alright this one''s tricky - don''t shy off! > > I''ve setup a multi-file uploader with Rails 3 + paperclip + Ajax > Upload (http://valums.com/ajax-upload/) > > My controller is as follows (which works): > > def upload > @photoalbum = PhotoAlbum.create > @photo = @photoalbum.photos.create({ :photo => > params[:file], :title => params[:filename], :description => "Uploaded > on #{Date.today.strftime("%b %d, %Y")}" }) > > respond_to do |format| > format.json > end > end > > The big issue here. is that if a User uploads 3 files, they are all > going to seperate albums. Rails uploads the 3 files, and each file has > it''s own uniquely added album. > > That''s bad. I need all the files uploaded in a batch to go to it''s own > album.. > > Any thoughts on how to solve for this? > > In the AJAX upload it is possible to pass a param. I thought about > passing an album ID, problem is that would lead to a lot of blank > albums, as the user doesn''t always upload photos. > > Geniuses wanted! thank you-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
The view where the upload lives? <script src="/javascripts/jquery/plugins/fileuploader.js" type="text/ javascript"></script> <div id="file-uploader"> <noscript> <p>Please enable JavaScript to use file uploader.</p> <!-- or put a simple form for upload here --> </noscript> </div> <script type="text/javascript"> $(function () { var uploader = new qq.FileUploader({ // pass the dom node (ex. $(selector)[0] for jQuery users) element: document.getElementById(''file-uploader''), params: { }, // path to server-side upload script action: ''/photos/upload'' }); }); </script> On Oct 23, 12:25 pm, zYan1de <zol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hm.. Do you think you could post your view too? > > On Oct 23, 5:48 pm, nobosh <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Alright this one''s tricky - don''t shy off! > > > I''ve setup a multi-file uploader with Rails 3 + paperclip + Ajax > > Upload (http://valums.com/ajax-upload/) > > > My controller is as follows (which works): > > > def upload > > @photoalbum = PhotoAlbum.create > > @photo = @photoalbum.photos.create({ :photo => > > params[:file], :title => params[:filename], :description => "Uploaded > > on #{Date.today.strftime("%b %d, %Y")}" }) > > > respond_to do |format| > > format.json > > end > > end > > > The big issue here. is that if a User uploads 3 files, they are all > > going to seperate albums. Rails uploads the 3 files, and each file has > > it''s own uniquely added album. > > > That''s bad. I need all the files uploaded in a batch to go to it''s own > > album.. > > > Any thoughts on how to solve for this? > > > In the AJAX upload it is possible to pass a param. I thought about > > passing an album ID, problem is that would lead to a lot of blank > > albums, as the user doesn''t always upload photos. > > > Geniuses wanted! thank you-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Just a question, Is it possible Ajax Upload "upload" the files one at the time? I mean, like, If you upload too photos it first calls /photos/upload once, then does it again for the second one? Sorry for my spelling, and if my response seems like mumbo-jumbo, I should have gone sleeping at-least 2 hours ago On Oct 23, 11:08 pm, nobosh <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The view where the upload lives? > > <script src="/javascripts/jquery/plugins/fileuploader.js" type="text/ > javascript"></script> > > <div id="file-uploader"> > <noscript> > <p>Please enable JavaScript to use file uploader.</p> > <!-- or put a simple form for upload here --> > </noscript> > </div> > > <script type="text/javascript"> > $(function () { > var uploader = new qq.FileUploader({ > // pass the dom node (ex. $(selector)[0] for jQuery users) > element: document.getElementById(''file-uploader''), > params: { > > }, > // path to server-side upload script > action: ''/photos/upload'' > });}); > > </script> > > On Oct 23, 12:25 pm, zYan1de <zol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hm.. Do you think you could post your view too? > > > On Oct 23, 5:48 pm, nobosh <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Alright this one''s tricky - don''t shy off! > > > > I''ve setup a multi-file uploader with Rails 3 + paperclip + Ajax > > > Upload (http://valums.com/ajax-upload/) > > > > My controller is as follows (which works): > > > > def upload > > > @photoalbum = PhotoAlbum.create > > > @photo = @photoalbum.photos.create({ :photo => > > > params[:file], :title => params[:filename], :description => "Uploaded > > > on #{Date.today.strftime("%b %d, %Y")}" }) > > > > respond_to do |format| > > > format.json > > > end > > > end > > > > The big issue here. is that if a User uploads 3 files, they are all > > > going to seperate albums. Rails uploads the 3 files, and each file has > > > it''s own uniquely added album. > > > > That''s bad. I need all the files uploaded in a batch to go to it''s own > > > album.. > > > > Any thoughts on how to solve for this? > > > > In the AJAX upload it is possible to pass a param. I thought about > > > passing an album ID, problem is that would lead to a lot of blank > > > albums, as the user doesn''t always upload photos. > > > > Geniuses wanted! thank you-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Correct it does upload the files one at a time. On Oct 23, 3:06 pm, zYan1de <zol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Just a question, Is it possible Ajax Upload "upload" the files one at > the time? > I mean, like, If you upload too photos it first calls /photos/upload > once, then does it again for the second one? > > Sorry for my spelling, and if my response seems like mumbo-jumbo, I > should have gone sleeping at-least 2 hours ago > On Oct 23, 11:08 pm, nobosh <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > The view where the upload lives? > > > <script src="/javascripts/jquery/plugins/fileuploader.js" type="text/ > > javascript"></script> > > > <div id="file-uploader"> > > <noscript> > > <p>Please enable JavaScript to use file uploader.</p> > > <!-- or put a simple form for upload here --> > > </noscript> > > </div> > > > <script type="text/javascript"> > > $(function () { > > var uploader = new qq.FileUploader({ > > // pass the dom node (ex. $(selector)[0] for jQuery users) > > element: document.getElementById(''file-uploader''), > > params: { > > > }, > > // path to server-side upload script > > action: ''/photos/upload'' > > });}); > > > </script> > > > On Oct 23, 12:25 pm, zYan1de <zol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hm.. Do you think you could post your view too? > > > > On Oct 23, 5:48 pm, nobosh <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Alright this one''s tricky - don''t shy off! > > > > > I''ve setup a multi-file uploader with Rails 3 + paperclip + Ajax > > > > Upload (http://valums.com/ajax-upload/) > > > > > My controller is as follows (which works): > > > > > def upload > > > > @photoalbum = PhotoAlbum.create > > > > @photo = @photoalbum.photos.create({ :photo => > > > > params[:file], :title => params[:filename], :description => "Uploaded > > > > on #{Date.today.strftime("%b %d, %Y")}" }) > > > > > respond_to do |format| > > > > format.json > > > > end > > > > end > > > > > The big issue here. is that if a User uploads 3 files, they are all > > > > going to seperate albums. Rails uploads the 3 files, and each file has > > > > it''s own uniquely added album. > > > > > That''s bad. I need all the files uploaded in a batch to go to it''s own > > > > album.. > > > > > Any thoughts on how to solve for this? > > > > > In the AJAX upload it is possible to pass a param. I thought about > > > > passing an album ID, problem is that would lead to a lot of blank > > > > albums, as the user doesn''t always upload photos. > > > > > Geniuses wanted! thank you-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hm.. the only solution i can think of right now is to call the upload function once and have a do loop in there. On Oct 24, 3:26 am, nobosh <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Correct it does upload the files one at a time. > > On Oct 23, 3:06 pm, zYan1de <zol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Just a question, Is it possible Ajax Upload "upload" the files one at > > the time? > > I mean, like, If you upload too photos it first calls /photos/upload > > once, then does it again for the second one? > > > Sorry for my spelling, and if my response seems like mumbo-jumbo, I > > should have gone sleeping at-least 2 hours ago > > On Oct 23, 11:08 pm, nobosh <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > The view where the upload lives? > > > > <script src="/javascripts/jquery/plugins/fileuploader.js" type="text/ > > > javascript"></script> > > > > <div id="file-uploader"> > > > <noscript> > > > <p>Please enable JavaScript to use file uploader.</p> > > > <!-- or put a simple form for upload here --> > > > </noscript> > > > </div> > > > > <script type="text/javascript"> > > > $(function () { > > > var uploader = new qq.FileUploader({ > > > // pass the dom node (ex. $(selector)[0] for jQuery users) > > > element: document.getElementById(''file-uploader''), > > > params: { > > > > }, > > > // path to server-side upload script > > > action: ''/photos/upload'' > > > });}); > > > > </script> > > > > On Oct 23, 12:25 pm, zYan1de <zol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hm.. Do you think you could post your view too? > > > > > On Oct 23, 5:48 pm, nobosh <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Alright this one''s tricky - don''t shy off! > > > > > > I''ve setup a multi-file uploader with Rails 3 + paperclip + Ajax > > > > > Upload (http://valums.com/ajax-upload/) > > > > > > My controller is as follows (which works): > > > > > > def upload > > > > > @photoalbum = PhotoAlbum.create > > > > > @photo = @photoalbum.photos.create({ :photo => > > > > > params[:file], :title => params[:filename], :description => "Uploaded > > > > > on #{Date.today.strftime("%b %d, %Y")}" }) > > > > > > respond_to do |format| > > > > > format.json > > > > > end > > > > > end > > > > > > The big issue here. is that if a User uploads 3 files, they are all > > > > > going to seperate albums. Rails uploads the 3 files, and each file has > > > > > it''s own uniquely added album. > > > > > > That''s bad. I need all the files uploaded in a batch to go to it''s own > > > > > album.. > > > > > > Any thoughts on how to solve for this? > > > > > > In the AJAX upload it is possible to pass a param. I thought about > > > > > passing an album ID, problem is that would lead to a lot of blank > > > > > albums, as the user doesn''t always upload photos. > > > > > > Geniuses wanted! thank you-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
As I see it, you are creating a new album here. If you are editing a existing album, you can send the album id along with your request. So here I think you need to change your logic; a users must create a album first, and upload his/her photos in the next step. Maybe that helps? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.