Please show me image upload method
How do I fix this error GET http://localhost:8000/C:/Users/Dell/AppData/Local/Temp/phpDF8F.tmp 404 (Not Found)
So, I am developing a system using laravel with livewire, but for some reason I got this error GET localhost:8000/C:/Users/Dell/AppData/Local/Temp/phpDF8F.tmp 404 (Not Found) in the console of my browser whenever I upload an image in a form, but when I submit the form, it works totally fine.
I tried searching on the internet but I can't find any solution. Can anyone know how to solve this? Need this ASAP for my capstone project.
I get it now guys why I am getting this error. It is because I'm using the same variable ($display_image) in my adding modal
<div class="row-auto mb-3">
<label for="add-display-image" class="form-label">Display Picture</label>
<input wire:model="display_image" id="add-display-image" type="file" class="form-control form-control-sm w-50" accept="image/*">
@error('display_image') <span class="error text-danger" style="font-size: 0.8rem">{{ $message }}</span> @enderror
</div>
and in my viewing modal
<div class="d-flex justify-content-center">
<img class="object-fit-contain border rounded place-img" src="{{ Storage::url($display_image) }}" alt="">
</div>
So, when I try to upload an image, the code in my viewing modal will attempt to locate the temporarily uploaded image in my storage/public directory, which the temporary image is not stored at. So, to fix this, I must create a different variable where the temporary image will store, so that, the code from the viewing modal will not attempt to look for the temporary uploaded image. For example, I will create a $add_display_image variable dedicated for the adding modal. The code in my adding modal will look like this:
<div class="row-auto mb-3">
<label for="add-display-image" class="form-label">Display Picture</label>
<input wire:model="add_display_image" id="add-display-image" type="file" class="form-control form-control-sm w-50" accept="image/*">
@error('add_display_image') <span class="error text-danger" style="font-size: 0.8rem">{{ $message }}</span> @enderror
</div>
Please or to participate in this conversation.