Enterprise‑grade file upload handler with MIME validation, size limits, image dimension checks, and atomic file operations.
Get Started FeaturesA PHP class that turns insecure file uploads into a reliable, secure, and developer‑friendly process.
Built with Object Oriented Programming (OOP) principles, SecureUploader validates files by their real MIME type (not just extension), enforces size limits, optionally checks image dimensions, and returns a clean UploadResult object. It follows all scit.zya.me contribution guidelines – includes at least one class, provides examples, and respects user tracking options.
Uses PHP's finfo to detect the actual file type – not the browser‑supplied $_FILES['type']. Blocks spoofed extensions (e.g., .jpg.exe).
Enforce maximum file size (in bytes) and optional image width/height constraints – perfect for avatars, banners, or gallery uploads.
Prevents file overwriting by appending a counter; sanitizes filenames to remove dangerous characters; uses temp + rename for safety.
Returns UploadResult with success, filePath, and errorMessage. No exceptions – easy to integrate.
Native support for daily imports from version control. The SCIT platform automatically pulls updates and notifies users.
Once approved on scit.zya.me, tens of thousands of developers receive an email – guaranteed audience for your work.
.zip or .tar.gz archive. (Registration may be required depending on the author’s tracking option – but examples/docs are always public.)classes/SecureUploader.php into your project (e.g., lib/). Then require it:
upload() and check the result:
chmod 755). That’s it!.htaccess to block script execution.setMaxImageDimensions() only for image types – it’s automatically ignored for PDFs.sanitizeFilename() method (default true) replaces unsafe characters with underscores.The full source with examples (single upload, multi upload) is included in the SCIT download. You can also view the live demo in the examples/ folder.
The SCIT platform offers three user tracking settings. For SecureUploader, the author chose Option 1 – "Yes, except when viewing non-class files".
| Option | What users see without login | Effect on rankings / update notifications |
|---|---|---|
| 0 – No tracking | All files (classes, examples, docs) | No download tracking, no update emails, not counted in top downloads |
| 1 – Non‑class files public | Examples, docs, other files. Classes require login | Logged‑in users are tracked (rankings + update emails). Anonymous users see most of the content. |
| 2 – Full tracking | Login required for any file view/download | Maximises tracking accuracy but may reduce initial interest. |
SecureUploader’s choice (Option 1) is the recommended compromise: new users can immediately see the examples and documentation, then decide to register for the class files.
Download SecureUploader now from scit.zya.me and join a community of thousands of developers.
Package approved under BSD 3‑Clause license • Compatible with PHP 8.1+ • Includes full examples & docs