I have an image upload system on my portfolio website that calls images from a database using PHP. Most of the files that are shown are images. Some of them however are PDF files and I would like to know how to open these PDF files in new windows as well as the images. Instead right now, it just downloads those PDF files to my computer. How do I fix this? This is my code:
?>
</div>
<ul class="media-list">
<?php
include "config.php"; //database connection
$res = $mysqli->query("SELECT * FROM upload_data");
while ($row = $res->fetch_assoc()):
?>
<?php ?>
<div class="media">
<a class="media-left" href="#">
</a>
<div class="img">
<a target="_blank" onclick="window.open('upload/<?php echo $row['file_name'] ?>','<?php echo $row['file_name'] ?>')">
<img width="300" height="200" src="upload/<?php echo $row['file_name'] ?>" alt="<?php echo $row['file_name'] ?>"></a>
</div>
</div>
<?php
endwhile;
?>
Thanks for any help!