So, I''m seeing something fully weird trying to use attachment_fu on a
linux server, and I know Rick Olson is chilling somewhere on this forum
- so I''m hoping he can poke his head out to help me here (although
honestly anyone with an answer will make me equally happy)
The deal is as follows: We''re developing an application which lets
users
upload (using attachment fu) any old filetype they want, and then to
re-download it. For the most part, this is working great UNTIL we upload
to our ubuntu linux test slice. Just to clarify, I''m on a mac (so UNIX
generally) and I''ve NEVER seen the linux slice act too much differently
than what I see on my own machine. In this case (for some reason), it
is. When I upload a file on my mac environment called "Engr Update 10760
copy.ppt" - i get the expected filename back when I re-download:
"Engr_Update_10760_copy.ppt": the underscores come from the "def
sanitize_filename" in attachment_fu.rb. So, by the same logic, on my
linux slice when I up/download a file i should get the same thing.
Somehow, I upload the file, and when I get it back, the name has changed
to "_Engr". The file is in-tact, but since it''s lopping off
the
finishing part of the filename (namely the .xxx extension), my windows
users are getting screwed. This only happens when I upload files with
spaces in the filename, and for some reason I just *can''t* get it to
stop happening, unless I overwrite the "thumbnail_name_for" method in
my
model such that:
def thumbnail_name_for(thumbnail = nil)
    extension = filename.scan(/\.\w+$/)
    return "#{self.id}#{extension}"
end
this way the linux server can''t get ''confused'' by the
original_filename
(specifically the spaces in it) and lop off my file extensions! At the
same time, my company would like to preserve SOME form of the original
filename (for our user''s convenience) - and I''m just spent on
it.
But my natural coder instinct tells me one thing: I can''t be the first
person to have this happen!! Ubuntu: most common linux distro in 2008.
Attachment_fu: most common image uploading plugin for RoR. Advice,
anyone?
-- 
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
-~----------~----~----~----~------~----~------~--~---
Alex (not telling)
2008-Feb-15  16:57 UTC
CORRECTION: attachment_fu and filenames on a linux machine
actually, the fix i listed up there doesn''t even work on my linux slice ( just figured it would) , i just get back (ONLY on the ubuntu slice) the id number with no extension (still, no extension!) -- 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 -~----------~----~----~----~------~----~------~--~---