'Laravel merge image by path to Request for validation
I'm very new to Laravel.
I'm trying to integrate temporary image upload to my forms.
What I want to do.
When the user selects a image the image gets uploaded temporarily to the server after verification (like max:1024|image).
And on the final submit we get the temporary image's url to our controller (works as planned till now).
Now I want to validate the image once again cause the temp directory is same for multiple types of images and different types of image can have different validation rules.
I tried to do
$simulatedUploadedFile = UploadedFile(Storage::disk('temp')->path($tempImageName), $tempImageName);
// Tried this
$request->files->set('image', $simulatedUploadedFile)
// Also this
$request->merge(['image' => $simulatedUploadedFile]);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
