Download the PHP package farzad-forouzanfar/secure-upload without Composer
On this page you can find all versions of the php package farzad-forouzanfar/secure-upload. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download farzad-forouzanfar/secure-upload
More information about farzad-forouzanfar/secure-upload
Files in farzad-forouzanfar/secure-upload
Package secure-upload
Short Description A secure file upload package with validation and antivirus integration.
License MIT
Homepage https://github.com/FarzadForuozanfar/SecureUpload
Informations about the package secure-upload
SecureUpload PHP
SecureUpload is a secure file upload library for PHP that ensures files are safely uploaded to your server by performing a series of security validations. It includes checks for file existence, extension and MIME type validation, content scanning for malicious code, and optional antivirus scanning via ClamAV.
Features
- File Existence Check: Ensures the uploaded file exists before processing.
- Extension & MIME Type Validation: Verifies that files have valid extensions and corresponding MIME types.
- Content Scanning: Detects and prevents malicious scripts or code embedded in files.
- Antivirus Integration: Uses ClamAV (triggered via a Python script) to scan files for threats, with logging support if enabled.
- PSR-4 Autoloading: Fully compliant with Composer autoloading standards for easy integration.
Requirements
- PHP: Version 7.4 or higher. (PHP Official Website)
- Python: Required for antivirus scanning. (Python Official Website)
-
ClamAV: For antivirus scanning:
-
macOS: Install via Homebrew using:
-
Linux: Install using your distribution's package manager. For Ubuntu, for example:
- Windows: Download from the ClamAV website and follow the installation instructions.
-
Installation
SecureUpload is available via Composer. To install, run the following command in your project directory:
Alternatively, clone the repository:
-
Clone the repository:
-
Navigate to the project directory:
- Install dependencies via Composer:
Configuration
-
Environment Variables:
Create or update your.env
file with the necessary configuration settings. -
Language Files:
Place your language files in thelang/
directory (e.g.,lang/lang-en.php
orlang/lang-fa.php
). - Web Server Setup:
Configure your web server to serve thepublic/
directory as the document root.
Usage
To use SecureUpload, simply include the Composer autoloader in your project and instantiate the uploader in your application code. For example, in your public/index.php
Usage via CLI
This package also provides a CLI tool that you can use for quick testing and configuration.
🔧 Publish .env
file
To publish the default .env
configuration file into your project root:
🧪 Test File Upload Validation
You can quickly test the validation logic via CLI using a file path:
Contributing
Contributions are welcome! If you encounter a bug or have a feature request, please open an issue on the GitHub repository. To contribute code, fork the repository and submit a pull request.
License
SecureUpload is licensed under the MIT License. See the LICENSE file for more details.
Screenshots
All versions of secure-upload with dependencies
ext-fileinfo Version *