You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.1 KiB
49 lines
1.1 KiB
<?php
|
|
/*
|
|
Uploadify 后台处理 Demo
|
|
Author:POOY
|
|
Date:2012-12-26
|
|
uploadify 后台处理 :http://www.pooy.net/uploadify-houtai.html
|
|
*/
|
|
|
|
//设置上传目录
|
|
$path = "uploads/";
|
|
|
|
if (!empty($_FILES)) {
|
|
echo '<pre>';
|
|
print_r($_FILES);
|
|
echo '</pre>';
|
|
exit;
|
|
//得到上传的临时文件流
|
|
$tempFile = $_FILES['Filedata']['tmp_name'];
|
|
|
|
//允许的文件后缀
|
|
$fileTypes = array('jpg','jpeg','gif','png');
|
|
|
|
//得到文件原名
|
|
$fileName = iconv("UTF-8","GB2312",$_FILES["Filedata"]["name"]);
|
|
$fileParts = pathinfo($_FILES['Filedata']['name']);
|
|
|
|
//接受动态传值
|
|
$files=$_POST['typeCode'];
|
|
|
|
//最后保存服务器地址
|
|
if(!is_dir($path))
|
|
mkdir($path);
|
|
if (move_uploaded_file($tempFile, $path.$fileName)){
|
|
echo $fileName;
|
|
}else{
|
|
echo $fileName."上传失败!";
|
|
}
|
|
|
|
|
|
|
|
/* if (in_array($fileParts['extension'],$fileTypes)) {
|
|
copy($tempFile,$targetFile);
|
|
echo $_FILES['Filedata']['name'];//上传成功后返回给前端的数据
|
|
file_put_contents($_POST['id'].'.txt','上传成功了!');
|
|
} else {
|
|
echo '不支持的文件类型';
|
|
} */
|
|
}
|
|
?>
|