-
Notifications
You must be signed in to change notification settings - Fork 0
/
multiple_upload.php
74 lines (68 loc) · 2.28 KB
/
multiple_upload.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<html>
<head>
<title>Upload the files for the patient</title>
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;400;500;600;700;900&family=Ubuntu:wght@300;400&display=swap"
rel="stylesheet"
/>
<style>
body{
background-color: black;
color: white;
text-align: center;
font-family: "Montserrat";
}
.input-id {
height: 4%;
width: 50%;
background-color: azure;
border: 3px solid slateblue;
}
.input-button {
background-color: yellow;
border: 1px solid white ;
font-size: 1rem;
/* width: 100px;
height: 30px; */
}
.input-button:hover{
background-color: greenyellow;
border: 2px solid white ;
}
</style>
</head>
<body>
<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>
<lottie-player src="https://assets10.lottiefiles.com/packages/lf20_umoglgxj.json" background="#000000" speed="1" style="width: 300px; height: 300px; margin-left:auto; margin-right:auto;" loop autoplay></lottie-player>
<br>
<br>
<br>
<br>
<form action="#" method="POST" enctype="multipart/form-data">
<h1>Enter patient id </h1>
<input type="text" class="input-id" name="id"><br><br>
<input type="file" name="doc[]" multiple><br><br>
<input type="submit" class="input-button" value="Upload file(s)" name="submit">
</form>
</body>
</html>
<?php
include("config.php");
if(isset($_POST['submit'])) {
foreach ( $_FILES['doc']['name'] as $key=>$val)
{
$ID=$_POST['id'];
$random = rand('11111', '99999');
$file = $random.'_'.$val;
move_uploaded_file($_FILES['doc']['tmp_name'][$key],'du_hacks/'.$file);
$query = "INSERT INTO filestoring (file_source,patient_id) VALUES ('$file','$ID')";
$data = mysqli_query($link, $query);
if($data) {
echo "";
}
else {
echo "Failed to upload the files";
}
}
}
?>