ok so the problem is, so strange
The css,js is loaded with assets, why my img not ? its same in public folder.
this method is correct right {{ URL::asset('img/01.jpg') }} ?
Hello, so im running to a wall. I want to save data in my project folder and display with filename in database. But it seems none of it works.
So im using this function to store the data image
public function insertproof(Request $request)
{
$id = $request['id'];
if ($request->hasFile('rent_proof')){
$filepath = $request->file('rent_proof')->store('public');
$result = rent::where('id',$id)->first();
$result->rent_proof=$filepath;
$result->save();
}
return redirect()->back()->with('status', 'proof updated');
}
this function gives me 'public/{filename}' on database and it saved at
storage/app/public
with storage:link it also gives me
public/storage
according to documentation, i can use something like this
{{ asset('storage/'.$rent->rent_proof) }}
but i cant seems to load it through my view
<button class="btn-success editrent"
data-id="{{ $rent->id }}"
data-proof="{{ $rent->rent_proof }}"
data-toggle="modal" data-target="#modal-insertproof">
<i class="fa fa-pencil" align="center">Input proof</i>
</button>
and this is my js
$(document).ready(function(){
$(document).on('click', '.editrent', function() {
$('#idrent').val($(this).data('id'));
$('#rentproof').val($(this).data('proof'));
});
my modal after i click
<form method="POST" action="{{route('visitor_rent.insertproof')}}" enctype="multipart/form-data">//use the insertproof controller
<div class="form-group">
<input type="file" class="form-control" name="rent_proof" id="rentproof" >
<img style="max-width: calc(100% - 20px)" src="{{ asset('storage/'.$rent->rent_proof) }}">
</div>
</form
im so confused, thanks for the care. this seems like a long post, sorry for that. in the console i read
GET http://127.0.0.1:8000/storage/public/HXVTfZo9UKuFRJCanOWrCeQw7flyJM9N8uUxUR5d.png 404 Not Found
what best approach to fix this ? i try to fix this but its like back on forth with public folder. thanks for the help..
Please or to participate in this conversation.