Fatal error when uploading a file

in Download Manager Free

Viewing 12 posts - 1 through 12 (of 12 total)
Apr 23, 2025 at 4:52 pm
#205584
Member
Historymakers
OP

Hello! How are you?
I’m getting the following error when trying to upload a file via WPDM. This error does not accour when uploading via default WP Media

PHP Fatal error: Uncaught TypeError: finfo_close(): Argument #1 ($finfo) must be of type resource, finfo given in /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php:991
Stack trace:
#0 /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php(991): finfo_close()
#1 /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php(1078): WPDM\__\FileSystem::getMimeType()
#2 /public_html/wp-content/plugins/download-manager/src/Admin/Menu/Packages.php(162): WPDM\__\FileSystem::validateUploadMimeType()
#3 /public_html/wp-includes/class-wp-hook.php(324): WPDM\Admin\Menu\Packages->uploadFile()
#4 /public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#5 /public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#6 /public_html/wp-admin/admin-ajax.php(192): do_action()
#7 {main}
thrown in /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php on line 991

Apr 23, 2025 at 5:02 pm
#205585
Member
Historymakers
OP

The problem seems to be the finfo_close($finfo) command in line 991 of /wp-content/plugins/download-manager/src/__/FileSystem.php
I have commented it and it worked normally

Apr 23, 2025 at 5:07 pm
#205587
Moderator
Tahasin
Staff

Hello,

I hope this message finds you well. I’m glad to hear that you have successfully identified the issue.
If you have any further questions or require additional assistance, please do not hesitate to reach out.

Regards

Apr 23, 2025 at 5:11 pm
#205589
Member
Historymakers
OP

Thanks for the reply!

Just a suggestion — since this issue caused a fatal error and was fixed by removing a single line in a plugin file, it might be worth reviewing this in the plugin code so that other users don’t run into the same problem.

Would be great to see it fixed in a future update.

Thanks again!

Apr 23, 2025 at 5:15 pm
#205591
Moderator
Tahasin
Staff

Are you using the latest version of Download Manager? If yes, kindly use this hook add_filter("wpdm_is_valid_mime_type", '__return_true'); in your theme’s function.php file and let me know if the problem persists.

Regards

Apr 27, 2025 at 12:08 am
#205738
Participant
Michael Nino

I get this error, and your filter didn’t help, do you have any other ideas?
[27-Apr-2025 00:05:23 UTC] PHP Fatal error: Uncaught Error: Class “finfo” not found in /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php:989
Stack trace:
#0 /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php(1078): WPDM\__\FileSystem::getMimeType(‘/…’)
#1 /public_html/wp-content/plugins/download-manager/src/Admin/Menu/Packages.php(212): WPDM\__\FileSystem::validateUploadMimeType(‘/…’, ‘hydro-one-outag…’)
#2 /public_html/wp-content/plugins/download-manager/src/Admin/Menu/Packages.php(159): WPDM\Admin\Menu\Packages->chunkUploadFile(‘/…’)
#3 /public_html/wp-includes/class-wp-hook.php(324): WPDM\Admin\Menu\Packages->uploadFile(”)
#4 /public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(”, Array)
#5 /public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#6 /public_html/wp-admin/admin-ajax.php(192): do_action(‘wp_ajax_wpdm_ad…’)
#7 {main}
thrown in /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php on line 989

Apr 27, 2025 at 1:45 am
#205739
Participant
Michael Nino

In case it helps in troublshooting, if I remove this line from the .htaccess file:
AddHandler application/x-httpd-ea-php83___lsphp .php .php8 .phtml
The Download Manager works fine. But this line is generated automatically by cPanel so it gets added back, see below how it looks in the .htaccess:

# php — BEGIN cPanel-generated handler, do not edit
# Set the “ea-php83” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php83___lsphp .php .php8 .phtml
</IfModule>
# php — END cPanel-generated handler, do not edit

Apr 27, 2025 at 4:37 am
#205743
Moderator
Tahasin
Staff

Thanks for sharing the information, we are checking the issue and will give you an update shortly.

Regards

Apr 27, 2025 at 3:52 pm
#205777

Well you replied to me on another support entry. I guess this is not a fix then. Is the syntax correct? All my other functions use single quotes not double. I am not knowledgeable in php.

Apr 27, 2025 at 3:53 pm
#205778

Where’s the old version so that we can roll back??????????

Apr 27, 2025 at 4:02 pm
#205780
Moderator
Tahasin
Staff

Hello, @Tom

If you have apply the mentioned code in your themes functions.php file, the problem should resolve.

Feel free to ask here, if you have any further queries.

Thanks for your understanding

Regards

Apr 27, 2025 at 4:04 pm
#205781
Moderator
Tahasin
Staff

You can download older versions from here

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.