Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mtdesigners's avatar

Laravel validation messages are different in Inertia/Vue component.

Hi, I am trying to upload a file using the Inertia form helper and Vue. But when the file validations fail the only error message I see is "The image failed to upload.", whereas in blade you get the proper error message if the type is wrong or the size is too big. Is there a different message bag for Inertia or this is just the way it handled?

My Controller:

$request->validate([
'avatar' => ['file', 'nullable', 'max:300'], 
]);

My Vue component:

<script setup>
import { useForm } from "@inertiajs/vue3";

const form = useForm({
  avatar: null,
});

const change = (e) => {
  form.avatar = e.target.files[0];
};

const submit = () => {
  form.post(route("register"));
};
</script>

<template>
<form @submit.prevent="submit">
<div>
<label for="avatar" >Avatar</label>
<input type="file" @input="change" id="avatar" />
<p>{{ form.errors.avatar }}</p>
</div>
<button>Submit</button>
</form>
</template>

Thank you all

0 likes
1 reply
gych's avatar

You should get the same validation messages in Inertia.

Please or to participate in this conversation.