[pmwiki-devel] $EnableUploadMimematch and "Call to undefined function mime_content_type()"

Simon nzskiwi at gmail.com
Sun Dec 24 21:20:46 PST 2023


That worked brilliantly, thanks for the incredibly fast response.

On Windows, when extension=fileinfo is not enabled I observe the following:
    When using DragDropMultiUpload
<https://www.pmwiki.org/wiki/Cookbook/DragDropMultiUpload> the upload never
finished and never faulted, it just hung.
    When using the upload form a *500 error* is received.

Is there any possibility of making this visible to the user?, e.g. DDMU
fail with an error,
My feeling is that all uploads should be denied.

I didn't notice this initially as my production website is hosted on Linux
(presumably with fileinfo enabled
<https://www.php.net/manual/en/fileinfo.installation.php>).
My dev env is on Windows, and I don't often upload files there, so as it
worked in prod I thought it was fine.

So for safety and visibility reasons I support denying uploads

Simon

PS watch this space for my new recipe GpxStat


On Mon, 25 Dec 2023 at 10:48, Petko Yotov <5ko at 5ko.fr> wrote:

> Apparently on Windows you need to enable the Fileinfo functions in
> php.ini, see:
>
>    https://www.php.net/manual/en/fileinfo.installation.php
>
> I have now documented this on the UploadVariables page.
>
> What should PmWiki do if $EnableUploadMimeMatch is enabled but not
> Fileinfo?
>
> - Act as if $EnableUploadMimeMatch is not enabled. This would work as it
> did before, other checks will be done.
>
> - Deny all uploads, since none can be checked.
>
> What do you think?
>
> Petko
>
>
>
>
> On 24/12/2023 21:28, Simon wrote:
> > Some time ago I enabled $EnableUploadMimematch [1]
> >
> > Recently I see
> >
> > [25-Dec-2023 08:25:00 Pacific/Auckland] PHP Fatal error:  Uncaught
> > Error: Call to undefined function mime_content_type() in
> > D:\Home\KiwiWiki\pmwiki\scripts\upload.php:405
> > Stack trace:
> > #0 D:\Home\KiwiWiki\pmwiki\scripts\upload.php(317):
> > UploadVerifyBasic()
> > #1 D:\Home\KiwiWiki\pmwiki\pmwiki.php(546): HandlePostUpload()
> > #2 D:\Home\KiwiWiki\pmwiki\pmwiki.php(533): HandleDispatch()
> > #3 {main}
> >   thrown in D:\Home\KiwiWiki\pmwiki\scripts\upload.php on line 405
> >
> > just wondering if anyone had an idea why?
> >
> > and seasons holiday's greetings from the summery south
> >
> > Simon
> >
> >
> >
> > Links:
> > ------
> > [1]
> > https://www.pmwiki.org/wiki/PmWiki/UploadVariables#EnableUploadMimeMatch
> > _______________________________________________
> > pmwiki-devel mailing list
> > pmwiki-devel at pmichaud.com
> > http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20231225/5f0ff20c/attachment.html>


More information about the pmwiki-devel mailing list