javascript - mime-type autodetection of .js file fails for http upload in firefox -
i'm using http upload transferring javascript file server. however, firefox sends content mime type set 'x-c'. opera 11 better in assuming 'application/x-javascript' still incorrect. i'd prefer avoid server-side mime type detection, there chance override mime-type detection specific file extensions (namely '.js') or provide hints browser algorithm ?
the ideal solution cross-browser ( @ least ff 3.6, ie8, chrome 8 should supported ). however, first step solution limited firefox welcome, too.
platform details: ff 3.6.13 on winxp sp3
uploaded file: jquery 1.4.4 ( uncompressed , minified versions ), elementary test files files have .js extension
thanks in advance efforts.
best regards, carsten
now html5 can read file properties using javascript file api, way can things checking mime type, name or file size. unfortunately available in firefox , chrome fir moment.
<input type="file" name="file" id="file" /> var file = document.getelementbyid('file').files[0];
then can check file properties
file.name // file name file.size // file size in bytes file.type // mime-type eje:'audio/mp3'
Comments
Post a Comment