Problem loading image on CKEditor

0

I am using ckeditor 4.11 and the problem is that you do not want to upload an image, it sends me a message that says "Incorrect server response".

This is what I have code:

index.php:

<form action="" method="post">
<textarea name="editor" id="editor">
</textarea>
<br>
<input type="button" value="Subir" name="boton" onClick="agregar();">
<script>
var editor = CKEDITOR.replace('editor');
</script>
</form>

In the config.js file of the ckeditor:

config.filebrowserUploadUrl = 'upload.php';

upload.php

<?php
$basePath = "imagenes/";

$baseUrl = "imagenes/";

$CKEditor = $_GET['CKEditor'] ;

$funcNum = $_GET['CKEditorFuncNum'] ;

$langCode = $_GET['langCode'] ;

$url = '' ;

$message = '';

if (isset($_FILES['upload'])) {

    $name = $_FILES['upload']['name'];

    move_uploaded_file($_FILES["upload"]["tmp_name"], $basePath . $name);

    $url = $baseUrl . $name ;
}
else
{
    $message = 'No file has been sent';
}

echo "<script type='text/javascript'> window.parent.CKEDITOR.tools.callFunction($funcNum, '$url', '$message')</script>";
?>

I upload the file upload.php to the same location where I have the index.php file.

In another older version that I have of ckeditor I have no problems but the issue is that this version is not compatible with the video plugin and that's why I had to change the version.

    
asked by Jorge Alonso 13.12.2018 в 16:31
source

0 answers