phpMussel upload handler

v3.5.1 2024-06-22 12:06 UTC

This package is auto-updated.

Last update: 2024-07-03 12:53:16 UTC


v1: PHP >= 5.4 < 8.4 v2: PHP >= 7.2 < 8.4 v3: PHP >= 7.2 License: GPL v2 PRs Welcome

What is phpMussel?

An ideal solution for shared hosting environments, where it's often not possible to utilise or install conventional anti-virus protection solutions, phpMussel is a PHP script designed to detect trojans, viruses, malware and other threats within files uploaded to your system wherever the script is hooked, based on the signatures of ClamAV and others.

What's this repository for?

This provides automatic file upload scanning to your website.

composer require phpmussel/web


// Path to vendor directory.
$Vendor = __DIR__ . DIRECTORY_SEPARATOR . 'vendor';

// Composer's autoloader.
require $Vendor . DIRECTORY_SEPARATOR . 'autoload.php';

$Loader = new \phpMussel\Core\Loader();
$Scanner = new \phpMussel\Core\Scanner($Loader);
$Web = new \phpMussel\Web\Web($Loader, $Scanner);
$Loader->Events->addHandler('sendMail', new \phpMussel\PHPMailer\Linker($Loader));

// Scans file uploads (execution terminates here if the scan finds anything).

// Fixes possible corrupted file upload names (Warning: modifies the content of $_FILES).

// Cleanup.
unset($Web, $Scanner, $Loader);

    <form enctype="multipart/form-data" name="upload" action="" method="post">
      <div class="spanner">
        <input type="file" name="upload_test[]" value="" />
        <input type="submit" value="OK" />

(And, after using that form to try uploading ascii_standard_testfile.txt, a benign sample provided for the sole purpose of testing phpMussel)…

Screenshot: Screenshot


See also:

Last Updated: 1 July 2024 (2024.07.01).