# FileGetMimeType() - throw an error on missing / empty files when strict=true

**URL:** <https://dev.lucee.org/t/filegetmimetype-throw-an-error-on-missing-empty-files-when-strict-true/11500>\
**Category:** proposals\
**Tags:** lucee-6\
**Created:** [November 18, 2022, 6:03pm UTC](https://dev.lucee.org/t/filegetmimetype-throw-an-error-on-missing-empty-files-when-strict-true/11500 "2022-11-18T18:03:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zackster](https://dev.lucee.org/user_avatar/dev.lucee.org/zackster/32/3484_2.png) [@Zackster](https://dev.lucee.org/u/Zackster)\
**Post date:** [November 18, 2022, 6:03pm UTC](https://dev.lucee.org/t/filegetmimetype-throw-an-error-on-missing-empty-files-when-strict-true/11500/1 "2022-11-18T18:03:08Z")

</div>

A proposed small Lucee 6.0 breaking change

Strict is by default **true**

- when strict is **false** , this existing behaviour will be supported.
- when strict is **true** , an empty or non existent file will now throw an error

> <https://github.com/lucee/Lucee/pull/1876/files>
>
> https://luceeserver.atlassian.net/browse/LDEV-2395

> **[FileGetMimeType() :: Lucee Documentation](https://docs.lucee.org/reference/functions/filegetmimetype.html)**
>
> Returns the mimetype of the given file

[https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-e-g/filegetmimetype.html](https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-e-g/filegetmimetype.html)

---

<div class="post-metadata">

**Author:** ![AdamCameron](https://dev.lucee.org/user_avatar/dev.lucee.org/adamcameron/32/4614_2.png) [@AdamCameron](https://dev.lucee.org/u/AdamCameron)\
**Post date:** [November 18, 2022, 7:00pm UTC](https://dev.lucee.org/t/filegetmimetype-throw-an-error-on-missing-empty-files-when-strict-true/11500/2 "2022-11-18T19:00:14Z")

</div>

This also gets it in sync with ColdFusion yeah? (the ticket isn’t flagged as `acf-compat`, so not sure you’ve noticed).

FYI, test results on CF, with `strict` = `true`

`valid.gif`: `image/gif`  
`empty.gif`: `image/gif`  
`actuallyJson.gif`: `text/plain`  
`actuallyXml.gif`: `application/xml`  
`nonExistent.gif`: `java.io.FileNotFoundException` / `/full/path/to/nonExistent.gif (No such file or directory)`

That’s what you should be aiming for, yeah? Lucee is the same, except the last one.

Note that this conflicts with the proposal above when it comes to how “empty” is handled.
