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.sh
This will automatically:
- Create the
.env
file - 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 serve
curl -F "file=@your_file.txt" http://localhost:8000
Response:
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.txt
curl 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:cleanup
Or set up a cron job to run this command periodically.
Run the test script to verify everything works:
./test-example.sh
This 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:
UploadedFile
handles file metadata and expiration logic - Controllers:
FileController
manages upload, download, and deletion - Commands:
CleanupExpiredFiles
for automatic cleanup - Views: Simple HTML page with usage instructions
- Database: SQLite with migrations for file tracking
MIT License