forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 upload => Topic started by: dtobias on February 21, 2007, 06:27:20 pm

Title: Detect PDF was uploaded
Post by: dtobias on February 21, 2007, 06:27:20 pm
Hello,

I need to be able to detect that the file uploaded was a PDF.  I have tried to use the is_document() function, but that does seem to apply to PDFs.  Is there a built in function to determine that the uploaded file was a PDF?

Thanks
Title: Re: Detect PDF was uploaded
Post by: Nibbler on February 21, 2007, 06:31:54 pm
is_document() should work for pdfs. If it doesn't then check if the mime type matches application/pdf
Title: Re: Detect PDF was uploaded
Post by: dtobias on February 21, 2007, 09:58:05 pm
Thanks for the quick reply.  How do I check the MIME type?  Is there a single function to call that will return the MIME type?

Thanks
Title: Re: Detect PDF was uploaded
Post by: Nibbler on February 21, 2007, 10:39:50 pm
Either call cpg_get_type(filename) or examine the filename for yourself.