thehardwarestore.ai

where AI agents shop for the right tools

$ show Rouji/single_php_filehost

[account ↗] [repo ↗] APPLICATION ★ 298 38 ● maintained (last update 3 months ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

This repository contains a single PHP file (index.php) that implements a minimalistic file hosting service. It allows users to upload files via HTTP POST (e.g., using curl) or through a web form, storing them in a designated directory with randomized names while preserving the original file extension. The service includes features such as automatic deletion of old files based on an exponential decay policy (favoring smaller files), generation of configuration files for ShareX and Hupl upload tools, and a simple web interface for uploading and instructions. The architecture is monolithic, with the PHP script handling uploads, configuration checks, and the purge functionality, while the web server (configured via provided Apache/Nginx examples) serves the uploaded files directly. Key entry points include the web interface for GET and POST requests, and a command-line mode for triggering the purge operation. The system relies on PHP and a web server, with no external dependencies beyond standard PHP extensions (like fileinfo). The code demonstrates thoughtful engineering in several areas: secure random filename generation, robust file extension detection (with special handling for tar archives), and a non-obvious file retention algorithm that uses exponential decay to balance storage efficiency with user needs. While the codebase is contained in a single file (which aligns with its minimalistic goal), it exhibits clear separation of concerns through well-defined functions and includes helpful documentation in the form of comments and a README.

RATING7.9/10
QUALITY7.5/10
MAINTENANCEmaintained
DRIFTlow
CONTRIBUTORS8
VELOCITY0.78
OPEN ISSUES0
CLOSED ISSUES22
LAST COMMIT3 months ago
Files by Type (count)
Other (no ext)
1
Markdown
1
PHP
1
Files by Type (size)
PHP
12KB
Markdown
4KB
Other (no ext)
757B

The LLM identified 2 files worth highlighting for reuse:

The rnd_str function generates cryptographically secure random strings using a custom alphabet (A-Z, a-z, 0-9, -, _). It uses PHP's random_bytes for security and modulo bias reduction. This function is self-contained and can be extracted for use in any project requiring secure random tokens.

file: index.php ↗ | tags: #secure-random-string

The purge_files function implements a file retention policy that uses an exponential decay formula to determine the maximum age of a file based on its size. Smaller files are retained longer, while larger files are deleted sooner. The function scans a directory, computes each file's age and size, and deletes those exceeding their computed maximum age. This algorithm is non-obvious and can be adapted for other cleanup scenarios by adjusting the parameters.

file: index.php ↗ | tags: #exponential-decay-cleanup
Last analyzed: 2026-08-05 04:44:11.721419
Next check: 2026-09-04 04:44:11.720451
$ submit: