-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformLoad.php
63 lines (58 loc) · 1.93 KB
/
formLoad.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
<?php
$activePage='formList';
$activeTitle="Form Management";
require 'ustHtml.php';
require 'loginControl.php';
require 'authorizationControl.php';
//Post islemi varsa
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$hedefKlasor = "./FORMLAR/";
$desteklenenTipler = ["pdf", "doc", "docx", "xls", "xlsx"];
$dosya = $_FILES["dosya"];
$dosyaIsmi = $dosya["name"];
$dosyaTipi = strtolower(pathinfo($dosyaIsmi, PATHINFO_EXTENSION));
if (!in_array($dosyaTipi, $desteklenenTipler)) {
echo '
<div class="container">
<div class="row">
<div class="alert text-center mt-3 alert-warning alert-dismissible fade show" role="alert">
Only PDF, DOC and XLS files can be uploaded.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</div>
</div>
';
} else {
$hedefYol = $hedefKlasor . $dosyaIsmi;
if (move_uploaded_file($dosya["tmp_name"], $hedefYol)) {
echo '
<div class="alert text-center mt-3 alert-success alert-dismissible fade show" role="alert">
The file has been uploaded successfully.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
';
} else {
echo '
<div class="alert text-center mt-3 alert-danger alert-dismissible fade show" role="alert">
An error occurred while uploading the file!!!.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
';
}
}
}
?>
<div class="container">
<div class="row">
<p class="text-center mt-3">
You can upload files to the frequently used forms page from here.
</p>
<div class="text-center">
<form method="POST" action="" enctype="multipart/form-data">
Select File: <input type="file" name="dosya"><br>
<button type="submit" class="btn btn-primary mt-3">Load Form <i class="bi bi-arrow-clockwise"></i> </button>
</form>
</div>
</div>
</div>
<?php require 'altHtml.php'; ?>