Home > Mobile >  image not showing on datatable and showing 404 not found when opened
image not showing on datatable and showing 404 not found when opened

Time:11-29

{
    name: 'file',
    data: 'file',
    "render": function (data, type, full, meta) {
        return "<img src=\"/public/storage/" data "\" height=\"50\"/>";   
    },
    "title": "identity",
    "orderable": true,
    "searchable": true,
},

My sql database store the image name and a function send the image to the public/storage folder, the idea is when the image is clicked it show the image. but instead it show 404 not found page, http://127.0.0.1:8000/public/storage/1669581019license.jpg = the address bar. file name is the same, no difference at all. please help my deadline is in a few hours.

i tried using the php artisan storage:link command and i also tried to change the directory. nothing happened

CodePudding user response:

Hello Ricky Ferdinand,

Hope you are doing well and good.

Replace your render code to below,

"render": function (data, type, row, meta) {
                    return '<img src="'   data   '" alt="'   data   '"height="16" width="16"/>';
                }
  • Related