Comments on: Attachment Fu and Zip Files – RubyZip and Extracting For Bulk Uploads http://www.glennfu.com/2008/06/19/attachment-fu-and-zip-files-rubyzip-and-extracting-for-bulk-uploads/ code like water, compile like bamboo! Tue, 25 Jan 2011 15:52:41 +0000 hourly 1 http://wordpress.org/?v=3.2.1 By: Rob Britton http://www.glennfu.com/2008/06/19/attachment-fu-and-zip-files-rubyzip-and-extracting-for-bulk-uploads/comment-page-1/#comment-72 Rob Britton Mon, 22 Dec 2008 01:34:54 +0000 http://www.glennfu.com/?p=35#comment-72 This code will fail if the zip file is under 10kB. This is because Rails will give you an UploadedStringIO object instead of a TempFile object for small uploads, and UploadedStringIO does not have a temp_path method. This code will fail if the zip file is under 10kB. This is because Rails will give you an UploadedStringIO object instead of a TempFile object for small uploads, and UploadedStringIO does not have a temp_path method.

]]>
By: Sean http://www.glennfu.com/2008/06/19/attachment-fu-and-zip-files-rubyzip-and-extracting-for-bulk-uploads/comment-page-1/#comment-64 Sean Tue, 23 Sep 2008 20:06:41 +0000 http://www.glennfu.com/?p=35#comment-64 On my Mac running mongrel I was getting errors and I found it's because the mime-type was not application/zip. I used this line: if ["application/zip", "application/x-zip-compressed"].include?(attachment.content_type) On my Mac running mongrel I was getting errors and I found it’s because the mime-type was not application/zip. I used this line:

if ["application/zip", "application/x-zip-compressed"].include?(attachment.content_type)

]]>
By: Glenn Ford http://www.glennfu.com/2008/06/19/attachment-fu-and-zip-files-rubyzip-and-extracting-for-bulk-uploads/comment-page-1/#comment-45 Glenn Ford Mon, 30 Jun 2008 23:26:12 +0000 http://www.glennfu.com/?p=35#comment-45 Hey thanks for that! I might use it myself ;) Hey thanks for that! I might use it myself ;)

]]>
By: Shep http://www.glennfu.com/2008/06/19/attachment-fu-and-zip-files-rubyzip-and-extracting-for-bulk-uploads/comment-page-1/#comment-44 Shep Mon, 30 Jun 2008 23:17:30 +0000 http://www.glennfu.com/?p=35#comment-44 This helped me out a lot. Thanks! One thing I added was to check for the OSX hidden directories in the archive. This is basically what I did. def is_hidden_file?(filename) if filename.include?("/") directory = filename.split("/")[0] file = filename.split("/")[1] directory.index(".") == 0 or directory.index("__") == 0 or (file.index(".") == 0 if file) else filename.index(".") == 0 end end This helped me out a lot. Thanks! One thing I added was to check for the OSX hidden directories in the archive. This is basically what I did.

def is_hidden_file?(filename)
if filename.include?(“/”)
directory = filename.split(“/”)[0]
file = filename.split(“/”)[1]
directory.index(“.”) == 0 or directory.index(“__”) == 0 or (file.index(“.”) == 0 if file)
else
filename.index(“.”) == 0
end
end

]]>