-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathLogUpload.php
31 lines (27 loc) · 948 Bytes
/
LogUpload.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
<?php
require_once 'BatLogToDb.php';
session_start();
//echo "<pre>";
//print_r($_FILES);
//print_r($_REQUEST);
//echo "</pre>";
if(!isset($_SESSION['users_id'])) {
echo json_encode(array("error"=>"You are not logged in"));
}
else {
if(isset($_FILES) && isset($_FILES['file']) && isset($_FILES['file']['name'])) {
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['file']['name']);
if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
//echo "The file ". basename( $_FILES['file']['name']). " has been uploaded<BR><BR>";
$retval = importBatLog($target_path, $_SESSION['users_id']);
echo json_encode($retval);
} else{
echo json_encode(array("error"=>"There was an error uploading the file, please try again!"));
}
}
else {
echo json_encode(array("error"=>"Bad Upload"));
}
}
?>