Hello,
I'm trying to get the lates CKeditor working with Perch to upload images and files. I managed to get the editor configured and showing the"upload" button when I try to upload an image, however when after selecting my image and clicking "send to server" the script fails.
Specifically when I inspect the HTTP headers I see the url being reference like so:
Request URL:http://blanchard.monkinteractive.com/site-admin/core/apps/content/edit/PERCH_LOGINPATH/addons/plugins/editors/ckeditor/uploader.php?filetype=image&CKEditor=perch_9_contact_body_content&CKEditorFuncNum=3&langCode=en-gb
It should read like the following:
Request URL:http://blanchard.monkinteractive.com/site-admin/addons/plugins/editors/ckeditor/uploader.php?
The uploader.php file works with CKeditor V3, I'm trying to port the code so it works with the latest version. I can't seem to track down what's adding the "/apps/content/edit/" to the url. Any ideas?
Here's my config file contents:
<script type="text/javascript" src="PERCH_LOGINPATH/addons/plugins/editors/ckeditor/ckeditor.js"></script>
<script>
$(function() {
CKEDITOR.replace( 'ckeditor', {
filebrowserUploadUrl = 'PERCH_LOGINPATH/addons/plugins/editors/ckeditor/uploader.php',
filebrowserImageUploadUrl = 'PERCH_LOGINPATH/addons/plugins/editors/ckeditor/uploader.php?filetype=image'
});
});
</script>
And here's the upload script:
<?php
# include the API
include('../../../../core/inc/api.php');
// test to see if image folder is writable
$image_folder_writable = is_writable(PERCH_RESFILEPATH);
$file = $_FILES['upload']['name'];
$filesize = $_FILES['upload']['size'];
$funcNum = $_GET['CKEditorFuncNum'];
//if the file is greater than 0, process it into resources
if($filesize > 0) {
if ($image_folder_writable && isset($file)) {
$filename = PerchUtil::tidy_file_name($file);
if (strpos($filename, '.php')!==false) $filename .= '.txt'; // diffuse PHP files
$target = PERCH_RESFILEPATH.DIRECTORY_SEPARATOR.$filename;
if (file_exists($target)) {
$filename = PerchUtil::tidy_file_name(time().'-'.$filename);
$target = PERCH_RESFILEPATH.DIRECTORY_SEPARATOR.$filename;
}
move_uploaded_file($_FILES['upload']['tmp_name'], $target);
$urlpath = PERCH_RESPATH.'/'.$filename;
$width = false;
$height = false;
$crop = false;
if(isset($_GET['filetype']) && $_GET['filetype'] == 'image') {
if(defined('PERCH_EDITORIMAGE_CROP') && PERCH_EDITORIMAGE_CROP == true) {
$crop = true;
}
if(defined('PERCH_EDITORIMAGE_MAXWIDTH') || defined('PERCH_EDITORIMAGE_MAXHEIGHT')) {
if(defined('PERCH_EDITORIMAGE_MAXWIDTH')) {
$width = PERCH_EDITORIMAGE_MAXWIDTH;
}
if(defined('PERCH_EDITORIMAGE_MAXHEIGHT')) {
$height = PERCH_EDITORIMAGE_MAXHEIGHT;
}
}else{
//no definitions, default to width.
$width = 640;
}
$PerchImage = new PerchImage();
$PerchImage->resize_image($target, $width, $height, $crop, 'ck');
$urlpath = $PerchImage->get_resized_filename(PERCH_RESPATH.'/'.$filename,false,false,'ck');
}
echo '<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction('.$funcNum.',"'.$urlpath.'");</script>';
} else {
echo '<p class="message">Upload failed. Is the directory writable?</p>';
}
} else {
echo '<p class="message">Upload failed.</p>';
}
?>Thanks!

I've been able to pinpoint
I've been able to pinpoint the problem more closely. The issue is the form upload URL, using chrome tools I was able to edit the image upload form submit url and get it working.
Here is the form upload iframe content, specifically the opening form tag. I need to figure out what piece of code is generating this form tag.
Does anyone know what's generating that form tag?