Hello All, I''ve been reading a lot of blogs/tutorials on how to go about uploading files to a server via a form in my application - they all pointed me in the direction that "File.open(self.path, "wb") { |f| f.write(@uploaded_file.read) }" is what will write the file to the new location on the server. I''ve tried this over and over again an each time the file moves over to the new location on my computer but the file becomes corrupt. Files don''t contain the data it should and pictures don''t open. I''m working on trying to use attachment_fu and other plugins that people have been raving about but in the mean time I thought to throw this problem at you guys and see if anyone else came across this issue and how they may have resolved it. (In case you are curious I need to be able to upload files like docs pdfs images zips to the server - the database will contain the filename and location.) So, has anyone had their files corrupt in their attempts to upload files to their server? Marra --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
are you using Windows? such problems are common in this OS. for reading a file, for example, you must use an ''rb'' parameter (e.g. "File.open(path, ''rb'')"), so perhaps there is some Windows requirement that you are missing. -- 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 -~----------~----~----~----~------~----~------~--~---
Thank you for replying! I am working on a Macintosh. It gives me an error No such file or directory - /Users/mariam/Documents/intervu/public/ data/artifacts/0714081149-Picture 1.png when I replace wb with rb. I''m going to research uploading files on macs instead. Marra On Jul 14, 11:40 am, PP Junty <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> are you using Windows? such problems are common in this > OS. for reading a file, for example, you must use > an ''rb'' parameter (e.g. "File.open(path, ''rb'')"), so > perhaps there is some Windows requirement that you > are missing. > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---