You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
620 B
PHTML
23 lines
620 B
PHTML
6 years ago
|
<?php
|
||
|
|
||
|
$save_folder = dirname(__FILE__) ."/js";
|
||
|
if(! file_exists($save_folder)) {
|
||
|
if(! mkdir($save_folder)) {
|
||
|
die("failed to create save folder $save_folder");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$key = 'filename';
|
||
|
$tmp_name = $_FILES["audiofile"]["tmp_name"];
|
||
|
$upload_name = $_FILES["audiofile"]["name"];
|
||
|
$type = $_FILES["audiofile"]["type"];
|
||
|
$filename = "$save_folder/$upload_name";
|
||
|
$saved = 0;
|
||
|
if(($type == 'audio/x-wav' || $type == 'application/octet-stream') && preg_match('/^[a-zA-Z0-9_\-]+\.wav$/', $upload_name) ) {
|
||
|
|
||
|
$saved = move_uploaded_file($tmp_name, $filename) ? 1 : 0;
|
||
|
}
|
||
|
|
||
|
//name is needed to send in the php file
|
||
|
|
||
|
?>
|