Minimal web app to:
- upload an image,
- generate a shareable link,
- display the image from that link.
- Frontend: Vanilla HTML, CSS, JavaScript
- Backend: Native PHP (no framework, no Node.js)
index.php- Upload pageapi/upload.php- Upload endpointimage.php- Shared image view page.htaccess- Pretty URL routing (/image/<id>)public/- Static assetsuploads/- Stored uploaded images
- Upload support: PNG, JPG/JPEG, WEBP, GIF
- Max file size: 10 MB
- Secure MIME validation server-side
- Random unique image IDs
- Shareable URL format:
/image/<id>
- Deploy files to a web server with PHP enabled (Apache recommended for
.htaccess). - Ensure
uploads/is writable by the web server user. - Open your domain root URL.
Request type: multipart/form-data
Field:
image(file)
Success response (201):
{
"id": "hex_id",
"viewUrl": "https://your-domain.com/image/hex_id",
"viewPath": "/image/hex_id",
"filePath": "/uploads/hex_id.jpg"
}This project is licensed under the MIT License. See the LICENSE file.