[Using Sakai] File type for uploaded files

Mike Jennings mike_jennings at unc.edu
Wed Feb 20 08:01:11 PST 2013


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


More information about the sakai-user mailing list