I am trying to upload images on a shared hosting but am unable to upload. On my machine it works well but when I host i cant figure how to change the paths.All the other pages are working fine except uploading images.
on my controller
foreach ($images as $image){
$move=$image->move(public_path().'/images2/',time().'_'.$image->getClientOriginalName());
if($move){
$imagedata=Images::create([
'title'=>time().'_'.$image->getClientOriginalName(),
'filename'=>time().'_'.$image->getClientOriginalName()
]);
Displaying the previous images is okay with this code on the view side
@foreach($product_images as $image)
<div class="carousel-item {{ $loop->first ? 'active' : '' }}">
<div> <img class="d-block w-100 newim" src="/images2/{{$image->filename}}"/></div>
</div>
@endforeach
2
Answers
I added this to index php though not sure whether it is secure but it works
i think your problem is here with the wrong "," :
change it to:
and make sure your folders are same name as you wrote in your code because host is sensitive to uppercase or lowercase