Bổ sung các tính năng điều khiển engine
This commit is contained in:
@@ -131,6 +131,33 @@ class UploadForm extends Model {
|
||||
}
|
||||
}
|
||||
|
||||
public function UploadSound($file, $fileTypes, $path) {
|
||||
$root = \Yii::getAlias('@app') . '/web/data';
|
||||
$LocalPath = "/" . $path;
|
||||
$RootFolder = $root . $LocalPath;
|
||||
$destfile = "welcome_en.wav";
|
||||
if (!empty($_FILES)) {
|
||||
$tempFile = $_FILES[$file]['tmp_name'];
|
||||
$targetPath = $RootFolder;
|
||||
if (!file_exists($targetPath)) {
|
||||
@mkdir($targetPath, 0777, true);
|
||||
}
|
||||
$targetFile = $targetPath . '/' . $destfile;
|
||||
$targetFileLocal = $LocalPath . '/' . $destfile;
|
||||
$fileParts = pathinfo($_FILES[$file]['name']);
|
||||
if (in_array(strtoupper($fileParts['extension']), $fileTypes)) {
|
||||
move_uploaded_file($tempFile, $targetFile);
|
||||
if (file_exists($targetFile)) {
|
||||
return $targetFileLocal;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Move file
|
||||
public function MoveFile($file, $folder) {
|
||||
$currentStorage = Storage::findOne(['stt' => 1])->folder;
|
||||
|
||||
Reference in New Issue
Block a user