当前位置: 首页>>代码示例>>PHP>>正文


PHP move_upload_file函数代码示例

本文整理汇总了PHP中move_upload_file函数的典型用法代码示例。如果您正苦于以下问题:PHP move_upload_file函数的具体用法?PHP move_upload_file怎么用?PHP move_upload_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了move_upload_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: up

 public function up($key)
 {
     if (!isset($_FILES[$key])) {
         return false;
     }
     $f = $_FILES[$key];
     //检验上传有没有成功
     if ($f['error']) {
         $this->errno = $f['error'];
         return false;
     }
     //获取后缀
     $ext = $this->getExt($f['name']);
     //检查后缀
     if (!$this->isAllowExt($ext)) {
         $this->errno = 8;
         return false;
     }
     //通过
     //创建目录
     $dir = $this->mk_dir();
     if ($dir == false) {
         $this->errno = 10;
         return false;
     }
     //生成随机文件名
     $newname = $this->randName() . '.' . $ext;
     $dir = $dir . '/' . $newname;
     //移动
     if (!move_upload_file($f['tmp_name'], $dir)) {
         $this->errno = 11;
         return false;
     }
     return str_replace(ROOT, '', $dir);
 }
开发者ID:kison30,项目名称:new,代码行数:35,代码来源:UpTool.class.php

示例2: sys_msg

     }
     $file = $_FILES['sqlfile'];
     /* 检查上传是否成功 */
     if (isset($file['error']) && $file['error'] > 0 || !isset($file['error']) && $file['tmp_name'] == 'none') {
         sys_msg($_LANG['fail_upload'], 1);
     }
     /* 检查文件格式 */
     if ($file['type'] == 'application/x-zip-compressed') {
         sys_msg($_LANG['not_support_zip_format'], 1);
     }
     if (!preg_match("/\\.sql\$/i", $file['name'])) {
         sys_msg($_LANG['not_sql_file'], 1);
     }
     /* 将文件移动到临时目录,避免权限问题 */
     @unlink($sql_file);
     if (!move_upload_file($file['tmp_name'], $sql_file)) {
         sys_msg($_LANG['fail_upload_move'], 1);
     }
 }
 /* 获取sql文件头部信息 */
 $sql_info = cls_sql_dump::get_head($sql_file);
 /* 如果备份文件的商场系统与现有商城系统版本不同则拒绝执行 */
 if (empty($sql_info['ecs_ver'])) {
     sys_msg($_LANG['unrecognize_version'], 1);
 } else {
     if ($sql_info['ecs_ver'] != VERSION) {
         sys_msg(sprintf($_LANG['version_error'], VERSION, $sql_info['ecs_ver']));
     }
 }
 /* 检查数据库版本是否正确 */
 if (empty($_GET['mysql_ver_confirm'])) {
开发者ID:554119220,项目名称:kjrscrm,代码行数:31,代码来源:database.php

示例3: intval

    $shipping_id = !empty($_POST['shipping']) ? intval($_POST['shipping']) : 0;
    //接收上传文件
    if (!empty($_FILES['bg']['name'])) {
        if (!get_file_suffix($_FILES['bg']['name'], $allow_suffix)) {
            echo '<script language="javascript">';
            echo 'parent.alert("' . sprintf($_LANG['js_languages']['upload_falid'], implode(',', $allow_suffix)) . '");';
            echo '</script>';
            exit;
        }
        $name = date('Ymd');
        for ($i = 0; $i < 6; ++$i) {
            $name .= chr(mt_rand(97, 122));
        }
        $name .= '.' . end(explode('.', $_FILES['bg']['name']));
        $target = ROOT_PATH . '/images/receipt/' . $name;
        if (move_upload_file($_FILES['bg']['tmp_name'], $target)) {
            $src = '/images/receipt/' . $name;
        }
    }
    //保存
    $sql = 'UPDATE ' . $ecs->table('shipping') . " SET print_bg = '{$src}' WHERE shipping_id = '{$shipping_id}'";
    $res = $db->query($sql);
    if ($res) {
        echo '<script language="javascript">';
        echo 'parent.call_flash("bg_add", "' . get_site_root_url() . $src . '");';
        echo '</script>';
    }
} elseif ($_REQUEST['act'] == 'print_del') {
    /* 检查权限 */
    check_authz_json('ship_manage');
    $shipping_id = !empty($_GET['shipping']) ? intval($_GET['shipping']) : 0;
开发者ID:netroby,项目名称:ecshop,代码行数:31,代码来源:shipping.php

示例4: sys_msg

         break;
 }
 /* 接收文件 */
 if ($ad_img['ad_img']['name'] && $ad_img['ad_img']['size'] > 0) {
     /* 检查文件合法性 */
     if (!get_file_suffix($ad_img['ad_img']['name'], $allow_suffix)) {
         sys_msg($_LANG['invalid_type']);
     }
     /* 处理 */
     $name = date('Ymd');
     for ($i = 0; $i < 6; $i++) {
         $name .= chr(mt_rand(97, 122));
     }
     $name .= '.' . end(explode('.', $ad_img['ad_img']['name']));
     $target = ROOT_PATH . DATA_DIR . '/afficheimg/' . $name;
     if (move_upload_file($ad_img['ad_img']['tmp_name'], $target)) {
         $src = DATA_DIR . '/afficheimg/' . $name;
     }
 } else {
     if (!empty($filter['content']['url'])) {
         /* 来自互联网图片 不可以是服务器地址 */
         if (strstr($filter['content']['url'], 'http') && !strstr($filter['content']['url'], $_SERVER['SERVER_NAME'])) {
             /* 取互联网图片至本地 */
             $src = get_url_image($filter['content']['url']);
         } else {
             sys_msg($_LANG['web_url_no']);
         }
     }
 }
 /* 入库 */
 switch ($filter['ad']['ad_type']) {
开发者ID:moonlight-wang,项目名称:feilun,代码行数:31,代码来源:flashplay.php

示例5: sys_msg

     }
     $file = $_FILES['sqlfile'];
     /* 检查上传是否成功 */
     if (isset($file['error']) && $file['error'] > 0 || !isset($file['error']) && $file['tmp_name'] == 'none') {
         sys_msg($_LANG['fail_upload'], 1);
     }
     /* 检查文件格式 */
     if ($file['type'] == 'application/x-zip-compressed') {
         sys_msg($_LANG['not_support_zip_format'], 1);
     }
     if (!preg_match("/\\.sql\$/i", $file['name'])) {
         sys_msg($_LANG['not_sql_file'], 1);
     }
     /* 将文件移动到临时目录,避免权限问题 */
     @unlink($sql_file);
     if (!move_upload_file($file['tmp_name'], saestor($sql_file))) {
         sys_msg($_LANG['fail_upload_move'], 1);
     }
 }
 /* 获取sql文件头部信息 */
 $sql_info = cls_sql_dump::get_head($sql_file);
 /* 如果备份文件的商场系统与现有商城系统版本不同则拒绝执行 */
 if (empty($sql_info['ecs_ver'])) {
     sys_msg($_LANG['unrecognize_version'], 1);
 } else {
     if ($sql_info['ecs_ver'] != VERSION) {
         sys_msg(sprintf($_LANG['version_error'], VERSION, $sql_info['ecs_ver']));
     }
 }
 /* 检查数据库版本是否正确 */
 if (empty($_GET['mysql_ver_confirm'])) {
开发者ID:sdssly,项目名称:port2sae,代码行数:31,代码来源:database.php

示例6: upload_article_file

function upload_article_file($upload)
{
    if (!make_dir("../" . DATA_DIR . "/article")) {
        /* 创建目录失败 */
        return false;
    }
    $filename = cls_image::random_filename() . substr($upload['name'], strpos($upload['name'], '.'));
    $path = ROOT_PATH . DATA_DIR . "/article/" . $filename;
    if (move_upload_file($upload['tmp_name'], $path)) {
        return DATA_DIR . "/article/" . $filename;
    } else {
        return false;
    }
}
开发者ID:norain2050,项目名称:mhFault,代码行数:14,代码来源:article.php

示例7: move_file

 /**
  *
  *
  * @access  public
  * @param
  *
  * @return void
  */
 function move_file($upload, $target)
 {
     if (isset($upload['error']) && $upload['error'] > 0) {
         return false;
     }
     if (!move_upload_file($upload['tmp_name'], $target)) {
         return false;
     }
     return true;
 }
开发者ID:skyshow,项目名称:government,代码行数:18,代码来源:cls_image.php

示例8: elseif

 } elseif ($type == 1) {
     if (isset($_FILES['upfile_flash']['error']) && $_FILES['upfile_flash']['error'] == 0 || !isset($_FILES['upfile_flash']['error']) && isset($_FILES['upfile_flash']['tmp_name']) && $_FILES['upfile_flash']['tmp_name'] != 'none') {
         /* 检查文件类型 */
         if ($_FILES['upfile_flash']['type'] != "application/x-shockwave-flash") {
             $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)');
             sys_msg($_LANG['upfile_flash_type'], 0, $link);
         }
         /* 生成文件名 */
         $urlstr = date('Ymd');
         for ($i = 0; $i < 6; $i++) {
             $urlstr .= chr(mt_rand(97, 122));
         }
         $source_file = $_FILES['upfile_flash']['tmp_name'];
         $target = ROOT_PATH . DATA_DIR . '/afficheimg/';
         $file_name = $urlstr . '.swf';
         if (!move_upload_file($source_file, $target . $file_name)) {
             $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)');
             sys_msg($_LANG['upfile_error'], 0, $link);
         } else {
             $ad_code = "ad_code = '{$file_name}', ";
         }
     } elseif (!empty($_POST['flash_url'])) {
         if (substr(strtolower($_POST['flash_url']), strlen($_POST['flash_url']) - 4) != '.swf') {
             $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)');
             sys_msg($_LANG['upfile_flash_type'], 0, $link);
         }
         $ad_code = "ad_code = '" . $_POST['flash_url'] . "', ";
     } else {
         $ad_code = '';
     }
 } elseif ($type == 2) {
开发者ID:Ryan007,项目名称:mybb,代码行数:31,代码来源:ads.php

示例9: post

 /**
  * 更新系统配置
  */
 public function post()
 {
     /* 允许上传的文件类型 */
     $allow_file_types = '|GIF|JPG|PNG|BMP|SWF|DOC|XLS|PPT|MID|WAV|ZIP|RAR|PDF|CHM|RM|TXT|CERT|';
     $arr = array();
     $res = $this->model->table('touch_shop_config')->field('id, value')->select();
     if (is_array($res)) {
         foreach ($res as $vo) {
             $arr[$vo['id']] = $vo['value'];
         }
     }
     foreach (I('value') as $key => $val) {
         if ($arr[$key] != $val) {
             $data['value'] = $val;
             $condition['id'] = $key;
             $this->model->table('touch_shop_config')->data($data)->where($condition)->update();
         }
     }
     /* 处理上传文件 */
     $file_var_list = array();
     $res = $this->model->table('touch_shop_config')->where("parent_id > 0 AND type = 'file'")->select();
     if (is_array($res)) {
         foreach ($res as $vo) {
             $file_var_list[$vo['code']] = $vo;
         }
     }
     foreach ($_FILES as $code => $file) {
         /* 判断用户是否选择了文件 */
         if (isset($file['error']) && $file['error'] == 0 || !isset($file['error']) && $file['tmp_name'] != 'none') {
             /* 检查上传的文件类型是否合法 */
             if (!check_file_type($file['tmp_name'], $file['name'], $allow_file_types)) {
                 $this->message(sprintf(L('msg_invalid_file'), $file['name']), NULL, 'error');
             } else {
                 if ($code == 'shop_logo') {
                     $info = get_template_info(C('template'));
                     $info['logo'] = empty($info['logo']) ? 'logo.png' : $info['logo'];
                     $file_name = str_replace('{$template}', C('template'), $file_var_list[$code]['store_dir']) . $info['logo'];
                 } elseif ($code == 'watermark') {
                     $name = explode('.', $file['name']);
                     $ext = array_pop($name);
                     $file_name = $file_var_list[$code]['store_dir'] . 'watermark.' . $ext;
                     if (file_exists($file_var_list[$code]['value'])) {
                         @unlink($file_var_list[$code]['value']);
                     }
                 } elseif ($code == 'no_picture') {
                     $name = explode('.', $file['name']);
                     $ext = array_pop($name);
                     $file_name = $file_var_list[$code]['store_dir'] . 'no_picture.' . $ext;
                     if (file_exists($file_var_list[$code]['value'])) {
                         @unlink($file_var_list[$code]['value']);
                     }
                 } else {
                     $file_name = $file_var_list[$code]['store_dir'] . $file['name'];
                 }
                 /* 判断是否上传成功 */
                 if (move_upload_file($file['tmp_name'], $file_name)) {
                     $data2['value'] = __ROOT__ . str_replace(array('./', '../'), '/', $file_name);
                     $this->model->table('touch_shop_config')->data($data2)->where("code = '{$code}'")->update();
                 } else {
                     $this->message(sprintf(L('msg_upload_failed'), $file['name'], $file_var_list[$code]['store_dir']), NULL, 'error');
                 }
             }
         }
     }
     /* 处理发票类型及税率 */
     $invoice_rate = I('invoice_rate');
     if (!empty($invoice_rate)) {
         foreach ($invoice_rate as $key => $rate) {
             $rate = round(floatval($rate), 2);
             if ($rate < 0) {
                 $rate = 0;
             }
             I('invoice_rate.' . $key, $rate);
         }
         $invoice = array('type' => I('invoice_type'), 'rate' => I('invoice_rate'));
         $data3['value'] = serialize($invoice);
         $this->model->table('touch_shop_config')->data($data3)->where("code = 'invoice_type'")->update();
     }
     /* 清除缓存 */
     clear_all_files();
     $site_info = site_info();
     $this->cloud->data($site_info)->act('post.record');
     $this->message(L('save_success'), url('index'));
 }
开发者ID:noikiy,项目名称:shop-3,代码行数:87,代码来源:ConfigController.class.php

示例10: upload_file

/**
 * 处理上传文件,并返回上传图片名(上传失败时返回图片名为空)
 *
 * @access  public
 * @param array     $upload     $_FILES 数组
 * @param array     $type       图片所属类别,即data目录下的文件夹名
 *
 * @return string               上传图片名
 */
function upload_file($upload, $type)
{
    if (!empty($upload['tmp_name'])) {
        $ftype = check_file_type($upload['tmp_name'], $upload['name'], '|png|jpg|jpeg|gif|doc|xls|txt|zip|ppt|pdf|rar|');
        if (!empty($ftype)) {
            $name = date('Ymd');
            for ($i = 0; $i < 6; $i++) {
                $name .= chr(mt_rand(97, 122));
            }
            $name = $_SESSION['user_id'] . '_' . $name . '.' . $ftype;
            //            $target = ROOT_PATH . DATA_DIR . '/' . $type . '/' . $name;
            $target = saestor(DATA_DIR . '/' . $type . '/' . $name);
            // for sae
            if (!move_upload_file($upload['tmp_name'], $target)) {
                $GLOBALS['err']->add($GLOBALS['_LANG']['upload_file_error'], 1);
                return false;
            } else {
                return $name;
            }
        } else {
            $GLOBALS['err']->add($GLOBALS['_LANG']['upload_file_type'], 1);
            return false;
        }
    } else {
        $GLOBALS['err']->add($GLOBALS['_LANG']['upload_file_error']);
        return false;
    }
}
开发者ID:sdssly,项目名称:port2sae,代码行数:37,代码来源:lib_main.php

示例11: session_id

        session_id($_GET["PHPSESSID"]);
    }
}
session_start();
require dirname(__FILE__) . '/includes/init.php';
require_once ROOT_PATH . '/' . ADMIN_PATH . '/includes/lib_goods.php';
include_once ROOT_PATH . '/includes/cls_image.php';
$image = new cls_image($_CFG['bgcolor']);
$goods_id = $_REQUEST['goods_id'];
/* 创建当月目录 */
$dir = date('Ym');
$dir = ROOT_PATH . $image->images_dir . '/' . $dir . '/';
create_folders($dir);
$img_name = $GLOBALS['image']->unique_name($dir);
$img_name = $dir . $img_name . $GLOBALS['image']->get_filetype($_FILES['Filedata']['name']);
move_upload_file($_FILES['Filedata']['tmp_name'], $img_name);
$img_original = str_replace(ROOT_PATH, '', $img_name);
$thumb_url = $GLOBALS['image']->make_thumb('../' . $img_original, $GLOBALS['_CFG']['thumb_width'], $GLOBALS['_CFG']['thumb_height']);
$pos = strpos(basename($img_original), '.');
$newname = dirname($img_original) . '/' . $GLOBALS['image']->random_filename() . substr(basename($img_original), $pos);
copy('../' . $img_original, '../' . $newname);
$img_url = $newname;
$GLOBALS['image']->add_watermark('../' . $img_url, '', $GLOBALS['_CFG']['watermark'], $GLOBALS['_CFG']['watermark_place'], $GLOBALS['_CFG']['watermark_alpha']);
$img_original = reformat_image_name('gallery', $goods_id, $img_original, 'source');
$img_url = reformat_image_name('gallery', $goods_id, $img_url, 'goods');
$thumb_url = reformat_image_name('gallery_thumb', $goods_id, $thumb_url, 'thumb');
$sql = "INSERT INTO " . $GLOBALS['ecs']->table('goods_gallery') . " (goods_id, img_url, img_desc, thumb_url, img_original) " . "VALUES ('{$goods_id}', '{$img_url}', '{$img_desc}', '{$thumb_url}', '{$img_original}')";
$db->query($sql);
function create_folders($dir)
{
    return is_dir($dir) or create_folders(dirname($dir)) and mkdir($dir, 0777);
开发者ID:firsteam,项目名称:falcons,代码行数:31,代码来源:upload2012.php

示例12: exampleimage

 public function exampleimage()
 {
     if (isset($_FILES['attach']) and is_uploaded_file($_FILES['attach']['tmp_name']) and $_FILES['attach']['error'] === 0) {
         $imgsize = $_FILES['attach']['size'];
         $maxsize = config_item('site_image_maxsize');
         if ($imgsize > $maxsize * 1024 * 1024) {
             JSON('error', '上传图片大小超过 ' . $maxsize . 'MB');
         }
         $imginfo = pathinfo($_FILES['attach']['name']);
         $imgexte = config_item('site_image_ext');
         $imgexte = explode('|', $imgexte);
         if (!in_array(strtolower($imginfo['extension']), $imgexte)) {
             JSON('error', '上传图片只允许 ' . implode(', ', $imgexte) . ' 格式');
         }
         $savepath = $this->_attach_dir . 'example' . DIRECTORY_SEPARATOR;
         if (@is_dir($savepath) === false) {
             create_dir($savepath);
         }
         $filename = date('dis') . rand(1000, 9999) . '.' . strtolower($imginfo['extension']);
         $fullname = $savepath . $filename;
         move_upload_file($_FILES['attach']['tmp_name'], $fullname);
         if (@is_file($fullname) === false) {
             JSON('error', '上传失败,找不到此文件');
         }
         list($width, $height, $type, $attr) = getimagesize($fullname);
         $fullpath = $fullname;
         $fullname = base_url($fullname);
         $data = array('filename' => $filename, 'fullpath' => $fullpath, 'filepath' => $fullname, 'width' => $width, 'height' => $height);
         JSON('success', '文件上传成功', $data);
     } else {
         JSON('error', '上传出现错误');
     }
 }
开发者ID:ruoL,项目名称:fun-x,代码行数:33,代码来源:upload.php

示例13: foreach

<?php

include "connection.php";
if (isset($_POST['log'])) {
    $nm = $_POST['nm'];
    $ds = $_POST['dl'];
    foreach ($_FILES['files']['name'] as $key => $name_tmp) {
        $name = $_FILES['files']['temp_name'][$key];
        $tmpnm = $_FILES['files']['tmp_name'][$key];
        $type = $_FILES['files']['type'][$key];
        $size = $_FILES['files']['size'][$key];
        $dir = "filedata/" . $name;
        $move = move_upload_file($tmpnm, $dir);
        if ($move) {
            $hsl = mysql_query("insert into filedata values('','{$nm}','{$ds}', '{$name}', '{$type}', '{$sze}', now()}");
            if ($hsl) {
                echo "<script>alert('Image')</script>";
            } else {
                echo "<script>alert('Error Table Database')</script>";
            }
        } else {
            echo "<script>alert('Gagal Upload')</script>";
        }
    }
}
?>

<html >
<head>
 </head>
   <body>
开发者ID:CharFourie,项目名称:wanderlust_site,代码行数:31,代码来源:uploads.php

示例14: upload4xheditor

 /**
  * xheditor Ajax上传后台处理
  * 
  */
 public function upload4xheditor()
 {
     $this->_chkLogin();
     import('@.ORG.Json');
     $jsonObj = new Json();
     $result = array('err' => '', 'msg' => '');
     $upExt = 'txt,rar,zip,jpg,jpeg,gif,png';
     //上传扩展名
     $upload_path = DOC_ROOT_PATH . get_upload_path();
     $tempDir = $upload_path . 'temp/tmp/';
     if (!is_dir($tempDir)) {
         mk_dir($tempDir, 0755);
     }
     $tempPath = $tempDir . date('YmdHis') . mt_rand(10000, 99999) . '.tmp';
     $localName = '';
     //在支持HTML5的浏览器中都将以HTML5方式上传
     if (isset($_SERVER['HTTP_CONTENT_DISPOSITION']) && preg_match('/attachment;\\s+name="(.+?)";\\s+filename="(.+?)"/i', $_SERVER['HTTP_CONTENT_DISPOSITION'], $info)) {
         file_put_contents($tempPath, file_get_contents("php://input"));
         $localName = $info[2];
     } else {
         $upfile = @$_FILES['filedata'];
         if (empty($upfile['tmp_name']) || $upfile['tmp_name'] == 'none') {
             $result['err'] = '无文件上传';
         } elseif (!empty($upfile['error'])) {
             switch ($upfile['error']) {
                 case '1':
                     $err = '文件大小超过了php.ini定义的upload_max_filesize值';
                     break;
                 case '2':
                     $err = '文件大小超过了HTML定义的MAX_FILE_SIZE值';
                     break;
                 case '3':
                     $err = '文件上传不完全';
                     break;
                 case '4':
                     $err = '无文件上传';
                     break;
                 case '6':
                     $err = '缺少临时文件夹';
                     break;
                 case '7':
                     $err = '写文件失败';
                     break;
                 case '8':
                     $err = '上传被其它扩展中断';
                     break;
                 case '999':
                 default:
                     $err = '无有效错误代码';
             }
             $result['err'] = $err;
         } else {
             move_upload_file($upfile['tmp_name'], $tempPath);
             $localName = $upfile['name'];
         }
     }
     if ($result['err']) {
         die($jsonObj->encode($result));
     }
     $fileInfo = pathinfo($localName);
     $extension = $fileInfo['extension'];
     if (!preg_match('/' . str_replace(',', '|', $upExt) . '/i', $extension)) {
         $result['err'] = '上传文件扩展名必需为:' . $upExt;
         die($jsonObj->encode($result));
     }
     $newFilename = date("YmdHis") . mt_rand(1000, 9999) . '.' . $extension;
     $attachDir = $upload_path . date('Ym') . '/';
     if (!is_dir($attachDir)) {
         mk_dir($attachDir, 0755);
     }
     $targetPath = $attachDir . $newFilename;
     rename($tempPath, $targetPath);
     if (is_file($tempPath)) {
         @unlink($tempPath);
     }
     $result['msg'] = str_replace(DOC_ROOT_PATH, '', $targetPath);
     die($jsonObj->encode($result));
 }
开发者ID:yunsite,项目名称:tp-coupon,代码行数:82,代码来源:PublicAction.class.php

示例15: array

     //若链接地址为空
     $links[] = array('text' => $_LANG['return_edit'], 'href' => 'flashplay.php?act=edit&id=' . $id);
     sys_msg($_LANG['link_empty'], 0, $links);
 }
 if (!empty($_FILES['img_file_src']['name'])) {
     if (!get_file_suffix($_FILES['img_file_src']['name'], $allow_suffix)) {
         sys_msg($_LANG['invalid_type']);
     }
     //有上传
     $name = date('Ymd');
     for ($i = 0; $i < 6; $i++) {
         $name .= chr(mt_rand(97, 122));
     }
     $name .= '.' . end(explode('.', $_FILES['img_file_src']['name']));
     $target = ROOT_PATH . DATA_DIR . '/afficheimg/' . $name;
     if (move_upload_file($_FILES['img_file_src']['tmp_name'], $target)) {
         $src = DATA_DIR . '/afficheimg/' . $name;
     }
 } else {
     if (!empty($_POST['img_src'])) {
         $src = $_POST['img_src'];
         if (strstr($src, 'http') && !strstr($src, $_SERVER['SERVER_NAME'])) {
             $src = get_url_image($src);
         }
     } else {
         $links[] = array('text' => $_LANG['return_edit'], 'href' => 'flashplay.php?act=edit&id=' . $id);
         sys_msg($_LANG['src_empty'], 0, $links);
     }
 }
 if (strpos($rt['src'], 'http') === false && $rt['src'] != $src) {
     @unlink(ROOT_PATH . $rt['src']);
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:31,代码来源:flashplay.php


注:本文中的move_upload_file函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。