You can use iframes to preview documents in your page. Simply provide the source of the document in the iframe src. You can use this method to preview pdf and document files. Now, Since browsers directly do not have integrated viewers for documents, you can use https://view.officeapps.live.com to preview Word, Excel, or PowerPoint document (as per the website). So, you can simply
@if(upload is image)
<img src="{{image url}}"/>
@elseif(upload is pdf)
<iframe src="{{pdf url}}" frameborder="0" style="width:100%;min-height:640px;"></iframe>
@elseif(upload is document)
<iframe src="https://view.officeapps.live.com/op/view.aspx?src={{urlendoe(doc url)}}" frameborder="0" style="width:100%;min-height:640px;"></iframe>
@else
//manage things here
@endif
If you want to preview zip and RAR files, check this out
In PHP is it possible to inspect the content of a Zip file without extracting its content first?
. I personally have not used this, but, yeah this might help.