forked from ahit/belldandy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupload.php
48 lines (41 loc) · 1.15 KB
/
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
<?php
include("func.php");
$id=$_GET['id'];
$data = explode(".",$id);
$sid = $data[0];
$pid = $data[1];
$modifiedData = $data[2];
$duc = get_periods($pid);
if($id==0){
$name = $_FILES['upload']['name'];
$valid_file_extensions = array(".mp3");
$file_extension = strrchr($_FILES["upload"]["name"], ".");
// Check that the uploaded file is actually a mp3
if (in_array($file_extension, $valid_file_extensions)) {
$to = "uploads/" . $name;
//move it to the right folder if is.
move_uploaded_file($_FILES["upload"]["tmp_name"], $to);
//update_sound($pid,$name);
echo $name;
}
else {
echo 'File not support!';
}
}
else{
$name = $_FILES['upload']['name'];
$valid_file_extensions = array(".mp3");
$file_extension = strrchr($_FILES["upload"]["name"], ".");
// Check that the uploaded file is actually a mp3
if (in_array($file_extension, $valid_file_extensions)) {
$to = "uploads/" . $name;
//move it to the right folder if is.
move_uploaded_file($_FILES["upload"]["tmp_name"], $to);
update_sound($pid,$name);
echo $name;
}
else {
echo 'File not support!';
}
}
?>