File Input
Choose a local product image and validate it on the server.
HTML
<form class="rlw-upload" method="post" enctype="multipart/form-data" hx-post="/demo/workspace/upload" hx-encoding="multipart/form-data" hx-target="find output" hx-sync="this:replace" data-rlw-upload>
<label class="rlw-file"><strong>Product photography</strong><small>Choose a PNG or JPEG up to 2 MB.</small>
<input name="photo" type="file" accept="image/png,image/jpeg" required aria-label="Product image">
</label>
<button class="rl-button rl-button-sm rl-button-secondary" type="submit">Check image</button>
<output class="rlw-status" role="status"></output>
</form>HTTP exchange
Use the preview to see the request and the HTML your server returns.Use in your app
Copy these tags into your page head once. Serve the files at the paths shown, then add the example’s template to your page.
Page assets
<link rel="stylesheet" href="/mero.css">
<link rel="stylesheet" href="/mero-workspace.css">
<script defer src="/vendor/htmx.min.js"></script>
<script defer src="/mero.js"></script>
<script defer src="/mero-workspace.js"></script>Point the HTMX attributes at your own HTML endpoints. Use the live preview’s HTTP exchange to inspect the request and response.
Download library and examples ↓