[thelist] Validating Mime Type of Uploads

Jason Handby jason.handby at corestar.co.uk
Wed Mar 28 10:16:26 CDT 2007

> > So it looks like there is no way to for the box I'm 
> uploading from to
> > tell the server that the MIME type is application/pdf 
> unless I install
> > Acrobat and associate PDF files with the correct program.
> Correct, and in addition to Erik's information; there is no 
> MIME content-type 
> for PDF (excepting that browsers and servers are already 
> including it as a 
> type, as an Official assignment it's not in the specs yet) so 
> your web server 
> is going to fall back to what the browser is telling it to 
> expect to be 
> uploaded, in your case the default: application/octet-stream.

Randal -- assuming you want to check that people are uploading valid
PDFs... another option would be to attempt to read them with a
server-side PDF component, catching any exception that occurs and
assuming this implies that the file is not a valid PDF.

A bit hacky but it might help you.


More information about the thelist mailing list