-
Notifications
You must be signed in to change notification settings - Fork 1
/
view-attachment.php
47 lines (34 loc) · 1.04 KB
/
view-attachment.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Amployment Jobs - View Attachment</title>
<link rel="shortcut icon" href="images/ico/favicon.png">
<link href="css/main.css" rel="stylesheet">
</head>
<body>
<?php
require 'constants/db_config.php';
$file_id = $_GET['id'];
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM tbl_other_attachments WHERE id = :fileid");
$stmt->bindParam(':fileid', $file_id);
$stmt->execute();
$result = $stmt->fetchAll();
foreach($result as $row)
{
$certificate = $row['attachment'];
$title = $row['title'];
?>
<iframe style="border:none;" src="ViewerJS/?title=<?php echo "$title"; ?>#<?php echo 'data:application/pdf;base64,'.base64_encode($certificate).'' ?>" height="100%" width="100%"></iframe>
<?php
}
}catch(PDOException $e)
{
}
?>
</body>
</html>