-
Notifications
You must be signed in to change notification settings - Fork 1
/
upload_xml_audio.php
33 lines (33 loc) · 1.09 KB
/
upload_xml_audio.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
<?php
session_start();
if($_FILES["xmlFileName"]["tmp_name"] == ""){
$_SESSION["result"] = "noXml";
header("Location: ./index.php");
exit;
}
if($_FILES["audioFileName"]["tmp_name"] == ""){
$_SESSION["result"] = "noAudio";
header("Location: ./index.php");
exit;
}
$extension = strtolower(substr($_FILES["audioFileName"]["name"],strlen($_FILES["audioFileName"]["name"])-4,strlen($_FILES["audioFileName"]["name"])));
if($extension != ".mp3" && $extension != ".wav"){
$_SESSION["result"] = "noAudio";
header("Location: ./index.php");
exit;
}
if (!(move_uploaded_file($_FILES["xmlFileName"]["tmp_name"], "./xml/input.xml"))) {
$_SESSION["result"] = "errXml";
header("Location: ./index.php");
exit;
}
if (!(move_uploaded_file($_FILES["audioFileName"]["tmp_name"], "./audio/audiofile"))) {
$_SESSION["result"] = "errAudio";
header("Location: ./index.php");
exit;
}
$_SESSION["result"] = "ok";
$_SESSION["xmlFileName"] = $_FILES["xmlFileName"]["name"];
$_SESSION["audioFileName"] = $_FILES["audioFileName"]["name"];
header("Location: ./index.php");
?>