[Using Sakai] File type for uploaded files

Matthew Jones jonespm at gmail.com
Wed Feb 20 08:05:38 PST 2013


Sakai trusts the browser first for determining mime type and some browsers
give the wrong type. This seems to happen really often with PDF files. If
the browser doesn't supply the mime, Sakai then it falls back secondarily
on the extension. Making the order configurable (extension first, browser
second) was discussed as a a possible feature as well as adding in a
library to detect the type, but it's not something that anyone has worked
on yet.

https://jira.sakaiproject.org/browse/KNL-101

On Wed, Feb 20, 2013 at 11:01 AM, Mike Jennings <mike_jennings at unc.edu>wrote:

> We have seen this issue happen when the browser mime types in firefox
> that have been corrupted for some reason.
>
> We use this simple cgi/html upload checker to see what mime type is
> associated with the upload
>
> ==> upload.cgi <==
> #!/bin/sh
> echo 'Content-Type: text/plain'
> echo
> exec 2>&1
> set -x
> grep -aim1 content-type
>
> ==> upload.html <==
> <form enctype="multipart/form-data" action="upload.cgi" method="POST">
>      <input name="file" type="file" />
>      <input type="submit" />
> </form>
>
> In firefox you can reset your memtypes by delete the mimeTypes.rdf file
> from the users firefox profile.
>
> Mike
>
>
>
>
>
> On 02/20/2013 10:47 AM, Norman Danner wrote:
> > I have one general question:  how do I assign default file types for
> > files that I upload to Sakai?
> >
> > More specifically, here are two cases that have come up recently.
> >
> > Occasionally I upload a PDF file, and it is marked with a file type of
> > application/binary.  This doesn't happen with all PDF files.  Certainly
> > all of them have filenames of the form XXX.pdf.
> >
> > Even more annoying (and special-case) is that I upload SML (Standard ML)
> > source code files, and those are assigned type application/binary.
> > Obviously these are not standard files, but I'd like them to default to
> > text/plain.
> >
> > Of course, I can set the file type manually after uploading by editing
> > the file details, but that is a real pain.  And apparently that data
> > isn't preserved with the file; if I upload a new version of the file, I
> > have to manually set the file type again.
> >
> > Can setting default file types by filename extension be done via Sakai
> > properties?  Is it something I have to configure in Tomcat?  Something
> else?
> >
> >       - Norman Danner
> >
>
> --
> =========================================
> Mike Jennings
> Teaching and Learning Developer
> T: 919.843.5013
> E: mike_jennings at unc.edu
> _______________________________________________
> sakai-user mailing list
> sakai-user at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-user
>
> TO UNSUBSCRIBE: send email to
> sakai-user-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-user/attachments/20130220/2b74e29b/attachment.html 


More information about the sakai-user mailing list