Blame view
php/upload.php
2.23 KB
cf76164e6 20190709 |
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 |
<?php $target_dir = "/etc/"; if($_POST['type'] != ""){ switch($_POST['type']){ case "ntp": $target_file = $target_dir .$_FILES["ntp"]["name"]; if (move_uploaded_file($_FILES["ntp"]["tmp_name"], $target_file)) { echo alert("The file ". basename( $_FILES["ntp"]["name"]). " has been uploaded.",'../index.php?item=file'); } else { echo alert("Sorry, there was an error uploading your file.",'../index.php?item=file'); } break; case "network": $target_file = $target_dir ."network/".$_FILES["network"]["name"]; if (move_uploaded_file($_FILES["network"]["tmp_name"], $target_file)) { echo alert("The file ". basename( $_FILES["network"]["name"]). " has been uploaded.",'../index.php?item=file'); } else { echo alert("Sorry, there was an error uploading your file.",'../index.php?item=file'); } break; case "config": $target_file = "/home/pi/Desktop/vAlert/bin/".$_FILES["config"]["name"]; if (move_uploaded_file($_FILES["config"]["tmp_name"], $target_file)) { echo alert("The file ". basename( $_FILES["config"]["name"]). " has been uploaded.",'../index.php?item=file'); } else { echo alert("Sorry, there was an error uploading your file.",'../index.php?item=file'); } break; case "vAlert8common": $target_file = "/home/pi/Desktop/vAlert/bin/".$_FILES["vAlert8common"]["name"]; if(move_uploaded_file($_FILES["vAlert8common"]["tmp_name"], $target_file)) { echo alert("The file ". basename( $_FILES["vAlert8common"]["name"]). " has been uploaded.",'../index.php?item=file'); } else { echo alert("Sorry, there was an error uploading your file.",'../index.php?item=file'); } break; case "eew": $target_file = "eewXML"; if (move_uploaded_file($_FILES["eew"]["tmp_name"], $target_file)) { echo alert("The file ". basename( $_FILES["eew"]["name"]). " has been uploaded.",'../index.php?item=eew'); } else { echo alert("Sorry, there was an error uploading your file.",'../index.php?item=eew'); } break; } } function alert($message,$url){ echo "<script>alert('".$message."');</script>"; echo "<script>location.href = '".$url."'</script>"; } ?> |