A simple file hosting service like 0x0.st built with Laravel 12.
- ✅ File upload via HTTP POST
- ✅ Automatic file expiration (24 hours for files ≤512KB, then decreases)
- ✅ Direct download links
- ✅ Manual deletion via token
- ✅ Support for all file types
- ✅ Maximum file size: 100MB
- Clone the repository
- Run the setup script:
./setup.shThis will automatically:
- Create the
.envfile - Start Docker containers
- Install dependencies
- Generate application key
- Run database migrations
- Set proper permissions
- Access the application at http://localhost:8000
If you prefer manual setup:
- Install dependencies:
composer install- Copy environment file:
cp env.example .env- Generate application key:
php artisan key:generate- Create SQLite database:
touch database/database.sqlite- Run migrations:
php artisan migrate- Start the development server:
php artisan servecurl -F "file=@your_file.txt" http://localhost:8000Response:
HTTP/1.1 200 OK
X-Delete: http://localhost:8000/delete/abc123def456...
Content-Type: text/plain
http://localhost:8000/file/xyz789abc123.txt
curl http://localhost:8000/file/xyz789abc123.txtcurl http://localhost:8000/delete/abc123def456...Files are automatically deleted based on their size:
- Files ≤512KB: 24 hours
- Larger files: Decreasing time based on logarithmic formula
To manually clean up expired files:
docker-compose exec app php artisan files:cleanupOr set up a cron job to run this command periodically.
Run the test script to verify everything works:
./test-example.shThis will:
- Create a test file
- Upload it to the service
- Download it back
- Show the response and delete URL
POST /- Upload a fileGET /file/{filename}- Download a fileGET /delete/{token}- Delete a fileGET /- View usage instructions
The application uses:
- Laravel 12
- PHP 8.4
- SQLite database
- Nginx web server
- Docker for containerization
The application follows Laravel best practices:
- Models:
UploadedFilehandles file metadata and expiration logic - Controllers:
FileControllermanages upload, download, and deletion - Commands:
CleanupExpiredFilesfor automatic cleanup - Views: Simple HTML page with usage instructions
- Database: SQLite with migrations for file tracking
MIT License