Cambio de multipart Axios

This commit is contained in:
2026-05-09 15:20:23 -06:00
parent 2d51c8f558
commit b41f94f436
4 changed files with 71 additions and 24 deletions
@@ -72,10 +72,18 @@
wire:model.live="photo"
x-ref="photo"
x-on:change="
photoName = $refs.photo.files[0].name;
const file = $refs.photo.files[0];
if (!file) return;
const maxBytes = 50 * 1024 * 1024;
if (file.size > maxBytes) {
$refs.photo.value = '';
alert('La foto supera el límite de 50 MB. Por favor elige una imagen más pequeña.');
return;
}
photoName = file.name;
const reader = new FileReader();
reader.onload = (e) => { photoPreview = e.target.result; };
reader.readAsDataURL($refs.photo.files[0]);
reader.readAsDataURL(file);
" />
<label class="form-label fw-bold mb-3">Foto de perfil</label>