Topic: Problem with attachment_fu when upload a .flv file

As the title described, I try to use attachment_fu to upload a normal .flv file, but rails report that, no content_type method defined. But it works well when upload images.
Other problem is, how can I change the sub directory of the uploaded file with attachment_fu?
thanks,
Stellit

Re: Problem with attachment_fu when upload a .flv file

forgot to post my model:
class Asset < ActiveRecord::Base

  has_attachment  :storage => :file_system,
                  :max_size => 100.megabytes,
                  :path_prefix => 'public/t'


  validates_as_attachment # ok two lines if you want to do validation, and why wouldn't you?
end

I just follow the tut from

Re: Problem with attachment_fu when upload a .flv file

100 megabyte uploads, wow.

okay :path_prefix => "public/images" this will change the dir for uploaded pictures.

fla is not strictly speaking an image file. you have to change/add this to your has_attachemnt
:content_type => :application/x-shockwave-flash #I'm not 100% on that, infact I doubt it will work big_smile

but that will mean you cant upload images.

--

Re: Problem with attachment_fu when upload a .flv file

strange, avi, wmv and mpeg have no problem with upload. Only .flv cannot recognize with content_type. I found the MIME type of flv is application/octet-stream, not video/x-flv nor  application/x-shockwave-flash.

Re: Problem with attachment_fu when upload a .flv file

I might be wrong, I thought that if nothing was given in the model it would default to image.

--

Re: Problem with attachment_fu when upload a .flv file

Apparently Adobe Flash doesn't set the proper mime-type/content-type. 

Try Tommas' "dirty little hack" involving the mimetype-fu plugin.

I didn't try the Flash part (my app didn't need it), but it solved a strange bug I was having with Windows tempfile content types.