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

Aniket_IN's avatar

Image validation by path

I'm very new to Laravel, using Laravel with Inertia, React. I'm trying to make something like Livewire's temporary upload system,

What I'm currently doing is, I have a specific route to store user's uploaded image to a temporary directory. then send the temporary image path to the front-end.

Now when the user submits the form, I'm sending the temporary image path to the controller. Now I need to validate the image, like the image actually exists, it's the appropriate size.

How can I do that..

0 likes
3 replies
Aniket_IN's avatar

@Nakov That I also thought, but at the end (on final form submit) we are submitting the uploaded image path, as it's just a string, anyone can modify it. we need to verfiy that, right?

Nakov's avatar

@Aniket_IN You can check if the file exists only, if it doesn't return an error:

Storage::exists($filePath)

Please or to participate in this conversation.