Home php教程 PHP开发 How to modify the uploaded image or file path in the UEditor editor

How to modify the uploaded image or file path in the UEditor editor

Dec 27, 2016 am 09:11 AM

Use ueditor editor. The attachment is in ueditor/php/upload/ by default. My attachment address is /data/upload/ in the root directory of the website. You need to modify ueditor as follows:

Step 1: Open php /config.php Modify the image directory

return array(

    //图片目录
    'imageSavePath' => array (
        '../../../../data/upload'
    )

);
Copy after login

Step 2: Remove the relative path after uploading the image php/imageUp.php

    $info["url"]=str_replace('../../../../', '', $info["url"]);
    echo "{'url':'" . $info["url"] . "','title':'" . $title . "','original':'" . $info["originalName"] . "','state':'" . $info["state"] . "'}";
    exit;
Copy after login

Step 3: Open ueditor.config.js to modify the image path

 ,imagePath:"/"
Copy after login

Step 4: If you want to modify the image generation path or image name

Modify the image generation path in php/Uploader.class.php

    private function getFolder()
    {
        $pathStr = $this->config[ "savePath" ];
        if ( strrchr( $pathStr , "/" ) != "/" ) {
            $pathStr .= "/";
        }
        $pathStr .= date( "Ym/d" );
        if ( !file_exists( $pathStr ) ) {
            if ( !mkdir( $pathStr , 0777 , true ) ) {
                return false;
            }
        }
        return $pathStr;
    }
Copy after login

Modify the file name in Search "fileNameFormat" in ueditor.all.min.js, and then modify it according to the official documentation!


For more related articles on how to modify the UEditor editor’s custom uploaded image or file path, please pay attention to the PHP Chinese website!


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)