Bonjour,

Voila je rencontre un petit problème avec mon code.
Je travail avec slim et tinymce , si quelqu'un peut m'aider voici mon code.

Code Js

<script>
tinymce.init({
    selector: '#mytextarea',
    plugins: 'advlist autolink link image lists charmap print preview emoticons paste',
    toolbar: 'undo redo | styleselect | bold italic underline | bullist numlist | link | image | alignleft aligncenter  alignright alignjustify | media | preview |  emoticons ',
    menubar: false,
    language: 'fr_FR',
    height: 300,
    a_configuration_option: 400,
    paste_data_images:true,
    automatic_uploads:true,
    images_upload_url: '../../app/upload/upload.php',
    // override default upload handler to simulate successful upload
   images_upload_handler : function(blobInfo, success, failure) {
            var xhr, formData;

            xhr = new XMLHttpRequest();
            xhr.withCredentials = false;
            xhr.open('POST', '../../app/upload/upload.php');

            xhr.onload = function() {
                var json;

                if (xhr.status != 200) {
                    failure('HTTP Error: ' + xhr.status);
                    return;
                }

                json = JSON.parse(xhr.responseText);

                if (!json || typeof json.file_path != 'string') {
                    failure('Invalid JSON: ' + xhr.responseText);
                    return;
                }

                success(json.file_path);
            };

            formData = new FormData();
            formData.append('file', blobInfo.blob(), blobInfo.filename());

            xhr.send(formData);
        },
});
</script>

Voici le code du php

<?php

$url = array("http://localhost:8080");

reset($_FILES);
$temp = current($_FILES);

if(is_uploaded_file($temp['tmp_name']))
{
    if(preg_match("/([^\w\s\d\-_~,;:\[\]\(\).])|([\.]{2,})/", $temp['name'])){
        header("HTTP/1.1 400 Invalid file name,Bad request");
        return;
    }

    // Validating Image file type by extensions
    if(!in_array(strtolower(pathinfo($temp['name'], PATHINFO_EXTENSION)), array("gif", "jpg", "png"))){
        header("HTTP/1.1 400 Invalid extension,Bad request");
        return;
    }

    $fileName = "../../app/Upload/" . $temp['name'];
    move_uploaded_file($temp['tmp_name'], $fileName);

    echo json_encode(array('file_path' => $fileName));
}
?>

Mais malheusement ça m'affiche HTTP Error: 404 .
Si vous pouvez m'aider ce sera un plus pour moi, merci

Aucune réponse