Hi all,
Somewhat of a noob here. I have a table that has 5 file fields, and they are named file, file2, file3, file4, file 5. All of them will be .doc files.
In firefox, I can upload these files just fine, and they will show up as Document.doc. In IE, it prepends the entire path.
C:\My Documents\User\Desktop\Document.doc
Which makes the file unreadable, and un-downloadable. I know that the sanitize method is supposed to fix this, but I can't figure out how to make it work. Here is what I've written in my model:
def self.sanitize_filename(filename) filename = File.basename(filename.gsub("\\", "/")) filename.gsub(/[^a-zA-Z0-9\.\-\+_]/,"_") end
Doesn't work. What do I need to do? This is bugging me so much.