master
  • uploadify.php 1.9KB

      <?php include_once("image.php") ?> <?php define('__BASE__', dirname(__FILE__)); if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/'; //$targetPath = '/mnt/xvdb1/tamron' . $_REQUEST['folder'] . '/'; $targetPath = str_replace('//','/',$targetPath); $new_file_name = new_name( $_FILES['Filedata']['name']); $targetFile = $targetPath. $new_file_name; $res = mkdir($targetPath, 0777, true); recurDirs($targetPath, false); //防止中文文件名乱码 $res = move_uploaded_file($tempFile, $targetFile); //返回文件相对地址 $water = 'water.gif'; $img = new image(); $img->param($targetFile)->water($targetFile,$water,9); echo get_relative_path($targetFile); } function new_name($filename){ $ext = pathinfo($filename); $ext = $ext['extension']; $name = basename($filename,$ext); $name = md5($name.time()).'.'.$ext; return $name; } function get_relative_path($path,$dir = 'data'){ $strlen = strlen(substr(__BASE__, 0, 17)); $path = substr($path, $strlen); return '/'.substr($path,strpos($path,$dir),strlen($path )); } function recurDirs($path, $isFile = false, $mode = 0777) { $dirArr = explode('/', $path); if (!is_array($dirArr) || empty($dirArr)) { return false; } // 过滤掉空目录 // $dirArr = Libs_Filter::clearEmptyValue($dirArr); if ($isFile) { array_pop($dirArr); } $dirStr = ''; foreach ($dirArr as $dir) { $dirStr .= '/' . $dir; if (!is_dir($dirStr)) { // @mkdir($dirStr, $mode, true); exec("mkdir -p {$dirStr}",$outPut,$returnVar); @chmod($dirStr, $mode); } } if ($isFile) { if (!file_exists($path)) { @touch($path, $mode); @chmod($path, $mode); } } return true; } ?>
    kodo - Gogs: Go Git Service

    Нет описания

    huangqimin001: 1da9278ecd :art: Change user avatar url лет %!s(int64=3): %!d(string=назад)
    ..
    migrations 96c4bec605 :art: Add api activity_group_share лет %!s(int64=5): %!d(string=назад)
    __init__.py 88c914df41 Guideline Login Error лет %!s(int64=8): %!d(string=назад)
    admin.py 7e9b7eb161 Opt лет %!s(int64=8): %!d(string=назад)
    apps.py 88c914df41 Guideline Login Error лет %!s(int64=8): %!d(string=назад)
    models.py 1da9278ecd :art: Change user avatar url лет %!s(int64=3): %!d(string=назад)
    tests.py 88c914df41 Guideline Login Error лет %!s(int64=8): %!d(string=назад)
    views.py 88c914df41 Guideline Login Error лет %!s(int64=8): %!d(string=назад)
    kodo - Gogs: Go Git Service

    Sin Descripción

    Kimi.Huang: 2c3d52313d Remove nickname %!s(int64=7) %!d(string=hace) años
    ..
    __init__.py 0ae1b7de95 tests %!s(int64=7) %!d(string=hace) años
    tests.py 2c3d52313d Remove nickname %!s(int64=7) %!d(string=hace) años