Example #1
0
            } else {
                if ($filesystem->mkdir($leadon . $ndir, 0777)) {
                    $path = $leadon . $ndir;
                }
            }
        }
        if ($error === null) {
            require "classes/class.upload.php";
            $my_uploader = new uploader();
            $my_uploader->max_filesize(ini_maxupload());
            $my_uploader->file_types($supportedextentions);
            $my_uploader->set_path($path);
            if ($my_uploader->upload('file')) {
                $my_uploader->save_file();
            }
            if ($my_uploader->upload_failed()) {
                $error = $my_uploader->get_error();
            }
            $image_file = $path . $my_uploader->fileinfo('filename');
            if (!file_exists($image_file)) {
                $error = $lang->phrase('admin_cms_file_does_not_exist');
            }
            $image_file = str_replace(realpath($config['fpath']) . DIRECTORY_SEPARATOR, '', $image_file);
            $image_file = str_replace(DIRECTORY_SEPARATOR, '/', $image_file);
        }
    }
    $filesize = formatFilesize(ini_maxupload());
    $htmlhead .= '<script type="text/javascript" src="templates/editor/wysiwyg-popup.js"></script>';
    echo head(' onLoad="loadImage();"');
    ?>
<form method="post" action="admin.php?action=cms&amp;job=doc_insert_image&amp;wysiwyg=<?php