-
Notifications
You must be signed in to change notification settings - Fork 0
/
retrive_file.php
51 lines (48 loc) · 1.33 KB
/
retrive_file.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
48
49
50
51
<?php
/*header("Content-Type: application/pdf");
$file = $_GET["file"] .".pdf";
header("Content-Disposition: attachment; filename=" . urlencode($file));
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
header("Content-Length: " . filesize($file));
//flush(); // this doesn't really matter.
$fp = fopen($file, "r");
while (!feof($fp))
{
echo fread($fp, 65536);
flush(); // this is essential for large downloads
}
fclose($fp);
*/
/*$conn = mysqli_connect('localhost','root','','demo');
if(!$conn)
{
die("error" . mysqli_error($conn));
}
$res = mysqli_query("select * from file");
while($row = mysqli_fetch_array($res))
{
echo $row["filename"];
echo "<input TYPE="submit" name="retrive" value="retrive" onclick="<?php echo $row=["path"]; ?>"/>";
}*/
?>
<!DOCTYPE html>
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<?php
$conn = mysqli_connect('localhost','root','','test');
$res = mysqli_query($conn,"select * from content");
echo "<table>";
while($row = mysqli_fetch_array($res))
{
echo "<tr>";
echo "<td>"; echo $row["filename"]; echo "</td>";
echo"<td>"; ?> <a href="<?php echo $row["filepath"]; ?>">Download</a> <?php echo "</td>";
}
?>
</body>
</html>