insight's avatar

How to give the path of public folder file in view(.blade.php) file ?

Dear Friends,

How to give the path of a file in public/audio/crow.ogg to a blade.php file in path reosurces/views/magazines ?

suppose please suggest here : source src="crow.ogg" type="audio/ogg" how to rewrite the value of src ...

Please advise

Thanks

Anes

0 likes
12 replies
tisuchi's avatar

You can add simply-

{{ url('/') }}/audio/crow.ogg

Hope will work for you.

4 likes
Paschal's avatar

@insight You Are better off with using the URL facade and calling the asset method for this kind of situations.

{{ URL::asset('public/audio/crow.ogg') }}
1 like
saqueib's avatar
saqueib
Best Answer
Level 2

just use {{ asset('audio/crow.ogg') }}, its will give public folder path

7 likes
tisuchi's avatar

@insight

You can give a try with asset() than.

<td>  <audio controls>
                  <source src="{{ asset('audio/crow.ogg') }}" type="audio/ogg">
                   Your browser does not support the audio element.
                  </audio> 
            </td>
insight's avatar

Dear Saurabh,

It's 404 page . My query is how to set the route to access that file ?

Thanks

Anes

insight's avatar

Dear friends ,

My problem is fixed. Typo in file name make the situation complicated.

So solution is : source src="{{ asset('audio/Crow.ogg') }}" type="audio/ogg"

Thanks alot all of You

Anes

Please or to participate in this conversation.