/**
* 图片上传类
* @param $file上传图片信息
* @param $ty
*/
function upload_pic($file, $ty) {
if (!is_uploaded_file($file["tmp_name"])) {//是否存在文件
tcmc::ShowMsg("图片不存在!", "turntable_index.php?op=index");
}
if (!in_array($file["type"], array('image/jpg', 'image/jpeg', 'image/png'))) {//检查文件类型
tcmc::ShowMsg("文件类型不符!", "turntable_index.php?op=index");
}
$destination_folder = CMS_ROOT . 'uploads/miaosha/';
if (!file_exists($destination_folder)) {
mkdir($destination_folder);
}
$pinfo = pathinfo($file["name"]);
$ftype = $pinfo['extension'];
$destination = $destination_folder . "turntable_" . $ty . time() . "." . $ftype;
$filename = $file["tmp_name"];
if (file_exists($destination) && $overwrite != true) {
tcmc::ShowMsg("同名文件已经存在了!", "turntable_index.php?op=index");
}
if (!move_uploaded_file($filename, $destination)) {
tcmc::ShowMsg("移动文件出错1!", "turntable_index.php?op=index");
} $len = strlen(CMS_ROOT);
$subdestination = substr($destination, $len - );
return $subdestination;
}

最新文章

  1. flash中设置文本字体样式
  2. 判断字符串的首字母 ---------startsWith
  3. UIBarButtonItem的创建
  4. python django 与数据库的交互
  5. NDK
  6. hbase查询,scan详解
  7. Html5 Canvas动画旋转的小方块;
  8. 快速开发 jQuery 插件的 10 大技巧(转)
  9. 如何将CELERY放到后台执行?
  10. PowerDesigner使用总结 转
  11. hibernate通过配置文件生成数据库信息
  12. 关键字中mysql数据库查询条件带中文无结果解决办法
  13. CSS float:right 在IE浏览器下换行
  14. iOS -- Effective Objective-C 阅读笔记 (6)
  15. Jenkins中使用GitLab的配置
  16. EasyUI动态修改easyui-textbox验证信息
  17. 第四十一课 KMP子串查找算法
  18. mysql 事务中如果有sql语句出错,会导致自动回滚吗?
  19. Graphviz 环境变量设置
  20. Python学习笔记:算法的重要性

热门文章

  1. 深入__proto__和prototype的区别和联系
  2. deno学习二 基本代码
  3. Web开发需要常见的问题
  4. C#细说多线程(下)
  5. 【BZOJ4445】[SCOI2015]小凸想跑步(半平面交)
  6. emacs之配置7,tabbar插件
  7. MySQL性能调优 – 你必须了解的15个重要变量
  8. LLMNR欺骗工具Responder
  9. Check failed: mdb_status == 0 (2 vs. 0) No such file or directory
  10. 【POJ】1062 昂贵的聘礼 (最短路)