Mime issues/Firefox

19 views
Skip to first unread message

Simon

unread,
Jul 28, 2009, 10:42:34 AM7/28/09
to Paperclip Plugin
Hi all,

We're using Paperclip to manage straight uploading of mp3 files to S3
(no pre or processing), we're restricting content types to the
following:

["audio/mpeg","audio/x-mpeg","audio/mp3","audio/x-mp3","audio/
mpeg3","audio/x-mpeg3","audio/mpg","audio/x-mpg","audio/x-
mpegaudio","application/mp3"]

Everything works nicely with most browsers, however we're having
terrible trouble with Firefox on Windows not sending uploads with the
correct mimetype..

We've attempted to override Paperclip::Attachment assign method to use
mimetype_fu to double check the mimetype if it doesn't match our list,
but this seems to be a little flaky so far.. (this hack is based on
this paperclip fork - http://github.com/dejanstrbac/paperclip/tree/master)

Has anyone any experience with/any tips on this issue?

Thanks in advance,
Simon.

Paul Nelligan

unread,
Jul 28, 2009, 11:01:47 AM7/28/09
to papercli...@googlegroups.com
Hi Simon

I've had similar issues, and have yet to resolve these.  I posted another thread on this group.  If you do a search for 'application/force-download' in the group you will find it. 

I would be interested in keeping in touch regarding these issues and sharing information.

cheers

Paul

Nellboy

unread,
Aug 17, 2009, 9:03:39 AM8/17/09
to Paperclip Plugin
Ok, after a little research and hacking, I've come up with a
relatively neat solution to this problem.... It involves using the
mime-types gem (sudo gem install mime-types), for some reason, I
couldn't get mimetype_fu working here.

ok, so my model is 'track', and the attachment is 'mp3'... don't
forget "require 'mime/types' " at the top of the model

here's the model code: http://www.pastie.org/585809

and here's the controller method:

http://www.pastie.org/585815

Hopefully this will help someone else

On Jul 28, 4:01 pm, Paul Nelligan <nell...@gmail.com> wrote:
> Hi Simon
>
> I've had similar issues, and have yet to resolve these.  I posted another
> thread on this group.  If you do a search for 'application/force-download'
> in the group you will find it.
>
> I would be interested in keeping in touch regarding these issues and sharing
> information.
>
> cheers
>
> Paul
>
> On Tue, Jul 28, 2009 at 3:42 PM, Simon <simonr...@gmail.com> wrote:
>
> > Hi all,
>
> > We're using Paperclip to manage straight uploading of mp3 files to S3
> > (no pre or processing), we're restricting content types to the
> > following:
>
> > ["audio/mpeg","audio/x-mpeg","audio/mp3","audio/x-mp3","audio/
> > mpeg3","audio/x-mpeg3","audio/mpg","audio/x-mpg","audio/x-
> > mpegaudio","application/mp3"]
>
> > Everything works nicely with most browsers, however we're having
> > terrible trouble with Firefox on Windows not sending uploads with the
> > correct mimetype..
>
> > We've attempted to override Paperclip::Attachment assign method to use
> > mimetype_fu to double check the mimetype if it doesn't match our list,
> > but this seems to be a little flaky so far.. (this hack is based on
> > this paperclip fork -http://github.com/dejanstrbac/paperclip/tree/master)

Jonathan Yurek

unread,
Aug 21, 2009, 2:53:23 PM8/21/09
to papercli...@googlegroups.com
Thanks for this. I think that I'll be adding support for the mime-
types gem soon, as relying on the browser for mime types seems like an
increasingly poor idea.
--
Jonathan Yurek, Founder and CTO
thoughtbot, inc.
organic brains. digital solutions.

617.482.1300 x114
http://www.thoughtbot.com/

Reply all
Reply to author
Forward
0 new messages