时间:2021-07-01 10:21:17 帮助过:6人阅读
/*
Uploadify 后台处理方法
*/
public function actionuploadify(){
//设置上传目录
$path = "./uplode/video/";
//这里$_FILES为空
if (!empty($_FILES)) {
//得到上传的临时文件流
$tempFile = $_FILES['Filedata']['tmp_name'];
//允许的文件后缀
$fileTypes = array('avi','rmvb','mpg','wav');
//得到文件原名
$fileName = iconv("UTF-8","GB2312",$_FILES["Filedata"]["name"]);
$fileParts = pathinfo($_FILES['Filedata']['name']);
//接受动态传值
$files=$_POST['typeCode'];
//最后保存服务器地址
if(!is_dir($path))
mkdir($path);
//判断singerInfo文件是否存在且不为空
$this->getSingFile();
if (move_uploaded_file($tempFile, $path.$fileName)){
$myfile = explode(".",$fileName);
$sql = $this->getfile($myfile[0],1);
if ($sql){
//songandSinger文档插入
$songSingerFile = "./uplode/image/songSinger.txt";
$this->getSongFile($myfile[0],$songSingerFile,"dSongAndSinger","kSingerID");
//songandType文档插入
$songTypeFile = "./uplode/image/songType.txt";
$this->getSongFile($myfile[0],$songTypeFile,"dSongAndType","kSongTypeID");
//songandStyle文档插入
$songStyleFile = "./uplode/image/songStyle.txt";
$this->getSongFile($myfile[0],$songStyleFile,"dSongAndStyle","kSongStyleID");
echo $fileName."文件上传成功,数据上传成功!";
}else{
echo $fileName."文件上传成功,数据上传失败!";
}
//
}else{
echo $fileName."上传失败!";
}
}
}
上传
request->baseUrl; ?>/css/uploadify.css"/>