Hello. I am implementing a system that allows you to add multiple attachments to a message. This raises a problem tho. If I try to upload the attachments _BEFORE_ adding the message (thus creating an ID to relate the attachment to), I will need to find a way to store the attachments on a temporary way that will allow me to attach one another later. But, if the user closes the browser before inserting the message, I get temporary and unecessary files lying around. If I only allow one attachment at a time, this can also raise a few problems: 1) You add a 20mb attachment and then your form doesn''t validate, wich means you''ll have to upload again 2) You will have to edit that message to attach more files (wich, IMHO, doesn''t make much sense). What would you do and how? Thanks in advance, Andr? -- Posted via http://www.ruby-forum.com/.
Hi Andr?, Andr? Medeiros wrote: <snip>> But, if the user closes the browser before inserting > the message, I get temporary and unecessary files lying around.<snip> What makes you want to treat the files differently than any other session data? I''m new to this and about to jump off on my first ''real'' project (i.e., will be deployed for use). Like yours, one piece of my app''s functionality is to allow the transfer of files to the user. I''d planned to treat the files more-or-less as ''children'' that may need to be cleaned up just like all the other contents of any abandoned ''cart.'' It sounds like maybe there''s something I need to be thinking about that I''m not. Any help will be much appreciated. Thanks, Bill
Bill Walton wrote:> Hi Andr?, > > Andr? Medeiros wrote: > > <snip> > >> But, if the user closes the browser before inserting >> the message, I get temporary and unecessary files lying around. > > <snip> > > What makes you want to treat the files differently than any other > session > data? I''m new to this and about to jump off on my first ''real'' project > (i.e., will be deployed for use). Like yours, one piece of my app''s > functionality is to allow the transfer of files to the user. I''d > planned to > treat the files more-or-less as ''children'' that may need to be cleaned > up > just like all the other contents of any abandoned ''cart.'' It sounds > like > maybe there''s something I need to be thinking about that I''m not. Any > help > will be much appreciated. > > Thanks, > BillI believe that files in this case cannot be treated as items that are added to a cart. That''s because adding an item to a cart takes only one click, 2secs waiting and maybe a 70kb download of new HTML. Uploading a file takes a little longer. That''s what worries me. Any other suggestions? Thanks in advance, Andr? -- Posted via http://www.ruby-forum.com/.
Hi Andr?, I don''t think I''m grokking your app. If the file already exists in the file system, I''m not understanding why I wouldn''t just put the {path}file name to be transferred in the ''cart.'' Why do I need to have the contents of the file in memory before the user commits to the transfer? Users expect downloads to take time so my strategy is to do as little processing as possible in the pre-click state. The only thing the send_file() method needs is the {path}filename. It even gives me the option to read the whole file into memory prior to transmit_start or to stream it. Have you done a spike with send_file() yet? What need(s) does it not satisfy? I hope it''s clear that I''m really interested in your answer. Like I said, I share the need to transfer (a) file(s) to the user and I was under the impression from reading the send_file() documentation that it was going to be pretty easy. If I''m wrong, it would be great to find out sooner rather than later ;-) Any info is greatly appreciated. Best regards, Bill ----- Original Message ----- From: "Andr? Medeiros" <andre.caum@gmail.com> To: <rails@lists.rubyonrails.org> Sent: Monday, February 20, 2006 12:23 PM Subject: [Rails] Re: Message with multiple attachments> Bill Walton wrote: > > Hi Andr?, > > > > Andr? Medeiros wrote: > > > > <snip> > > > >> But, if the user closes the browser before inserting > >> the message, I get temporary and unecessary files lying around. > > > > <snip> > > > > What makes you want to treat the files differently than any other > > session > > data? I''m new to this and about to jump off on my first ''real'' project > > (i.e., will be deployed for use). Like yours, one piece of my app''s > > functionality is to allow the transfer of files to the user. I''d > > planned to > > treat the files more-or-less as ''children'' that may need to be cleaned > > up > > just like all the other contents of any abandoned ''cart.'' It sounds > > like > > maybe there''s something I need to be thinking about that I''m not. Any > > help > > will be much appreciated. > > > > Thanks, > > Bill > > I believe that files in this case cannot be treated as items that are > added to a cart. That''s because adding an item to a cart takes only one > click, 2secs waiting and maybe a 70kb download of new HTML. Uploading a > file takes a little longer. That''s what worries me. > > Any other suggestions? > > Thanks in advance, > Andr? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails