0

I have upload word file and excel file using php and I want to display this files to view page .

I tried the following code :

<td>
   <img style="width:12px !important; height:12px !important;"
    class="w-h-12"
    src="/manage/public/uploads/docs/2018/10/208149311.docx">
</td>

Nothing is displaying in view list. Then i tried I frame

 <iframe src="/manage/public/uploads/docs/2018/10/208149311.docx" style="width:200px; height:200px;" frameborder="0"></iframe> 

it's also not working for me

For jpg images it's working fine

Ezra
  • 247
  • 1
  • 12

2 Answers2

0

Google docs viewer can handle this.

   <?php $url="/manage/public/uploads/docs/2018/10/208149311.docx";  ?>
   <iframe src="http://docs.google.com/viewer?url=<?=urlencode($url)?>&embedded=true"  style="position: absolute;width:200px; height: 200px;border: none;"></iframe>
Pankaj Yadav
  • 123
  • 7
0

Browsers natively don't support viewing .doc or .docx or excel files. You have to use the Google Docs Viewer inside an iframe like this

<iframe style="width: 100%" height="500px" src="//docs.google.com/gview?url=http://www.picssel.com/demos/downloads/Fancybox.doc&embedded=true"></iframe>

But remember it will not work on localhost because it will first download the file to it's own drive then it will show you that file.

RopAli Munshi
  • 1,780
  • 3
  • 17
  • 30