上传卡券logo图片. $file为 $_FILES['xxx'];

@param  string $file 文件

@return string.  获取地址  http://mmbiz.qpic.cn/mmbiz/NdxGKqW8jE9GbAqUEPdSgSvbUbProSmE8NbUFwIYnp0Duibs611ZsCLza6b2dS8Ex3CO5dtv0u1HP9QY32djCxA/0
189516
public function cardUpload_img($file)
    {
        if (!$file) {
            $this->setError('参数缺失');

            return false;
        }

        $node = 'uploadimg';

        $name        = 'media'; // 设置上传文件键名 固定为media
        $filename    = $file['name']; // 设置上传文件名
        $filetype    = $file['type'];
        $filecontent = file_get_contents($file['tmp_name']); // 读取临时文件里 上传文件的信息
        $key         = "name=\"{$name}\"; filename=\"{$filename}\"\r\nContent-Type: {$filetype}\r\n"; // curl设置上传文件的一种方法.

        $param       = [];
        $param[$key] = $filecontent;

        $res = $this->_post($node, $param, false);

        return $res;
    }
1155164
protected function renderFileInfo(File $file)
    {
        return \sprintf(
            '%s <span class="tl_gray">(%s%s)</span>',
            $file->path,
            static::getReadableSize($file->size),
            (($file->isGdImage || $file->isSvgImage) ? ', ' . $file->width . 'x' . $file->height . ' px' : '')
        );
    }
1129815
protected function getFileUploadPath($file)
    {
        // check if path override is defined for current file
        $pathOverrideMethod = camel_case(strtolower($this->uploadFieldName) . 'UploadFilePath');

        if (method_exists($this, $pathOverrideMethod)) {
            return $this->getImageUploadPath() . '/' . $this->$pathOverrideMethod($file);
        }

        return $this->getImageUploadPath() . '/' . $file->hashName();
    }
1241336
public function getUrl($file, $type): string
    {
        if (!$this->checkPermission($type)) {
            $file = $this->noImage;
        }

        $filePath = $this->getCachePath($file, $type);

        if (file_exists($filePath['system']) && (time() - filemtime($filePath['system']) < $this->cacheTime)) {
            return $filePath['public'];
        }

        return Url::toRoute([$this->imageAction, 'path' => urlencode($file), 'type' => $type]);
    }
1215884
public function getAuthenticationTypeFilePath($_file)
    {
        $f = $this->mapAuthenticationTypeFilePath($_file);
        if ($f->exists()) {
            return $f->url;
        }

        return false;
    }
217807
public function getFilePath($file): string
    {
        if (null === ($fileObj = $this->container->get('huh.utils.file')->getFileFromUuid($file))) {
            return '';
        }

        return $fileObj->path;
    }
221291
private function setContaoFile($file)
    {
        if (is_array($file)) {
            return serialize(array_map([__CLASS__, 'setContaoFile'], $file));
        }

        if ($file instanceof FilesModel) {
            return $file->uuid;
        }
        if (Validator::isStringUuid($file)) {
            return StringUtil::uuidToBin($file);
        }
        return $file;
    }
691457
public static function urlencodeFilename($file) {
    $parts = explode('/', $file);
    $result = [];
    foreach ($parts as $part) {
      $result[] = rawurlencode($part);
    }
    return join('/', $result);
  }
661417
public function file($file)
    {
        if (\in_array($file, ['global', 'system', 'local'])) {
            $this->arguments[] = '--' . $file;
        } else {
            $this->arguments[] = '--file';
            $this->arguments[] = $file;
        }
        return $this;
    }
570876
public static function file( $file )
	{
		$params = array_merge( static::$params, array(
			'time' => time(),
			'fingerprint' => \CCSession::fingerprint(),
			'random' => CCStr::random(),
		));
		
		foreach( $params as $param => $value )
		{
			$file = str_replace( ':'.$param, $value, $file );
		}
		
		return $file;
	}
600681
protected function render($file = '')
    {
        if (!$file) {
            $file = substr(get_class($this), 0, -6);
        }

        $filename = APP_PATH . '/widgets/' . $file . '/' . $file . '.tpl.php'; //视图全路径

        if (!file_exists($filename)) {
            throw_error("widget模版文件：{$filename} 不存在，请检查以确认。");
        }

        if (!empty($this->tVar)) {
            extract($this->tVar);
        }

        // 释放assign的变量
        include $filename;
    }
406779
public static function filename($file, $last = true) {
        $pos = false;
        if ($last) {
            $pos = strrpos($file, '.');
        }
        else {
            $pos = strpos($file, '.');
        }
        if ($pos === false) {
            return $file;
        }
        return substr($file, 0, $pos);
    }
124178
private function templateEngineParse($file)
	{
		if (Config::get('@.TEMPLATE_ENGINE_ON'))
		{
			$cacheFileName = Config::get('@.TEMPLATE_CACHE_FOLDER') . '/' . md5($file);
			// 启用模版引擎
			$cacheFile = Cache::getInstance('DefaultFile')->getFileName($cacheFileName);
			if($this->cacheIsExpired($cacheFile))
			{
				// 判断模版缓存是否存在
				$t=$this->parseTemplate($file);
				// 没有模版缓存，解析模版并写入缓存
				Cache::set($cacheFileName, $t, array ('raw'=>true));
			}
			// 执行
			return $cacheFile;
		}
		else
		{
			return $file;
		}
	}
1015040
function addFile( file ) {
            var $li = $( '<li id="' + file.id + '">' +
                    '<p class="title">' + file.name + '</p>' +
                    '<p class="imgWrap"></p>'+
                    '<p class="progress"><span></span></p>' +
                    '</li>' ),

                $btns = $('<div class="file-panel">' +
                    '<span class="cancel">删除</span>' +
                    '<span class="rotateRight">向右旋转</span>' +
                    '<span class="rotateLeft">向左旋转</span></div>').appendTo( $li ),
                $prgress = $li.find('p.progress span'),
                $wrap = $li.find( 'p.imgWrap' ),
                $info = $('<p class="error"></p>'),

                showError = function( code ) {
                    switch( code ) {
                        case 'exceed_size':
                            text = '文件大小超出';
                            break;

                        default:
                            text = '上传失败，请重试';
                            break;
                    }

                    $info.text( text ).appendTo( $li );
                };

            if ( file.getStatus() === 'invalid' ) {
                showError( file.statusText );
            } else {
                // @todo lazyload
                $wrap.text( '预览中' );
                uploader.makeThumb( file, function( error, src ) {
                    if ( error ) {
                        $wrap.text( '不能预览' );
                        return;
                    }

                    var img = $('<img src="'+src+'">');
                    $wrap.empty().append( img );
                }, thumbnailWidth, thumbnailHeight );

                percentages[ file.id ] = [ file.size, 0 ];
                file.ratation = 0;
            }

            file.on('statuschange', function( cur, prev ) {
                if ( prev === 'progress' ) {
                    $prgress.hide().width(0);
                } else if ( prev === 'queued' ) {
                    $li.off( 'mouseenter mouseleave' );
                    $btns.remove();
                }

                // 成功
                if ( cur === 'error' || cur === 'invalid' ) {
                    showError( file.statusText );
                    percentages[ file.id ][ 1 ] = 1;
                } else if ( cur === 'queued' ) {
                    percentages[ file.id ][ 1 ] = 0;
                } else if ( cur === 'progress' ) {
                    $info.remove();
                    $prgress.css('display', 'block');
                }

                $li.removeClass( 'state-' + prev ).addClass( 'state-' + cur );
            });

            $li.on( 'mouseenter', function() {
                $btns.stop().animate({height: 30});
            });

            $li.on( 'mouseleave', function() {
                $btns.stop().animate({height: 0});
            });

            $btns.on( 'click', 'span', function() {
                var index = $(this).index(),
                    deg;

                switch ( index ) {
                    case 0:
                        uploader.removeFile( file );
                        return;

                    case 1:
                        file.ratation += 90;
                        break;

                    case 2:
                        file.ratation -= 90;
                        break;
                }

                // -webkit-transform: rotate(90deg);
                index && (deg = 'rotate(' + file.ratation + 'deg)', $wrap.css({
                    '-webkit-transform': deg,
                    '-mos-transform': deg,
                    '-o-transform': deg,
                    'transform': deg
                }));
            });

            $li.appendTo( $queue );
        }
87588
private function secureCheck($file)
    {
        //文件上传失败，检查错误码
        if ($file['error'] != 0) {
            switch ($file['error']) {
                case 1:
                    $this->errorInfo = '上传的文件大小超过了 php.ini 中 upload_max_filesize 选项限制的值';
                    break;
                case 2:
                    $this->errorInfo = '上传文件的大小超过了 HTML 表单中 MAX_FILE_SIZE 选项指定的值';
                    break;
                case 3:
                    $this->errorInfo = '文件只有部分被上传';
                    break;
                case 4:
                    $this->errorInfo = '没有文件被上传';
                    break;
                case 6:
                    $this->errorInfo = '找不到临时文件夹';
                    break;
                case 7:
                    $this->errorInfo = '文件写入失败';
                    break;
                default:
                    $this->errorInfo = '未知上传错误！';
            }
            return false;
        }

        //文件上传成功，进行自定义检查
        if ( (-1 != $this->config['maxSize']) &&  ($file['size'] > $this->config['maxSize']) ) {
            $this->errorInfo = '上传文件大小不符';
            return false;
        }

        //检查文件Mime类型
        if (!$this->checkType($file['type'])) {
            $this->errorInfo = '上传文件mime类型允许';
            return false;
        }

        //检查文件类型
        if (!$this->checkExt($file['extension'])) {
            $this->errorInfo ='上传文件类型不允许';
            return false;
        }

        //检查是否合法上传
        if (!is_uploaded_file($file['tmp_name'])) {
            $this->errorInfo = '非法的上传文件！';
            return false;
        }
        return true;
    }
1271821
public static function get($file)
    {
        $type = str_replace('image/', NULL, Singleton::class('ZN\Helpers\Mime')->type($file));

        return $type === 'jpg' ? 'jpeg' : $type;
    }
1133997
public function cleanPath(string $file) : string
  {
    return (substr($file, 0, 1) == DIRECTORY_SEPARATOR ? substr($file, 1) : $file);
  }