Page 1 of 1

Image upload problem in CKEditor (information pages)

Posted: Mon Nov 08, 2010 10:40 pm
by MrMuddy
Hi all,

I'm struggling with an issue uploading images inside the CKEditor in the information pages of my OpenCart install.

It's pretty much a clean install, using a custom template for the store front. The installation lives inside a subdirectory (/shop)

I can upload images for the products and categories with no problems, but when I try to upload images in the actual editor, I run into problems.

Everything seems to work OK... I can browse for the file, click on 'Send it to the server' but then it fails. With a bit of testing, it looks like the address field is being replaced by the actual file manager itself (see attached screenshot... although it's difficult to see)

The config for the editor is pointing uploads at the filemanager controller (config.filebrowserUploadUrl = 'index.php?route=common/filemanager';)

Browser choice doesn't seem to make any difference.

Any pointers are greatly appreciated ! I'm on OC version 1.4.9.1 and everything else is working fine...



Thanks in advance !

Re: Image upload problem in CKEditor (information pages)

Posted: Wed Nov 24, 2010 12:08 pm
by clinton4
I have the same problem, did you figure it out?

Re: Image upload problem in CKEditor (information pages)

Posted: Wed Nov 24, 2010 4:24 pm
by MrMuddy
I haven't been working on that project for a couple of weeks, so I haven't been back to look at it yet to be truthful. In some ways I'm glad it's not just me with the problem, I was starting to think I was going mental. I'll be back on it next week, so if nobody else knows a solution, I'll be looking for one properly then !

Cheers

Re: Image upload problem in CKEditor (information pages)

Posted: Wed Nov 24, 2010 5:34 pm
by Daniel
its not happening with me.

try refreshing your browser.

aslo copy and past your view source from the imae properties box.

Re: Image upload problem in CKEditor (information pages)

Posted: Sat Dec 04, 2010 5:32 am
by clinton4

Re: Image upload problem in CKEditor (information pages)

Posted: Fri Jun 24, 2011 11:03 am
by Ashura
1. modify template files that use CKEditor ( ex: admin/view/template/catalog/product_form.tpl , information_form.tpl ...)
find :

Code: Select all

	filebrowserUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
	filebrowserImageUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
	filebrowserFlashUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>'
change to :

Code: Select all

	filebrowserUploadUrl: 'index.php?route=common/filemanager/upload&token=<?php echo $token; ?>',
	filebrowserImageUploadUrl: 'index.php?route=common/filemanager/upload&token=<?php echo $token; ?>',
	filebrowserFlashUploadUrl: 'index.php?route=common/filemanager/upload&token=<?php echo $token; ?>'
2. modify function upload() in admin/controller/common/filemanager.php
find :

Code: Select all

if (isset($this->request->post['directory'])) {
insert before it

Code: Select all

// set default directory and upload file id for CKEditor
if ( isset($this->request->get['CKEditorFuncNum']) ) {
    $this->request->post['directory'] = '';
    $this->request->files['image'] = $this->request->files['upload'];
}
find :

Code: Select all

$this->load->library('json');

$this->response->setOutput(Json::encode($json));
change to :

Code: Select all

// response for CKEditor
if ( isset($this->request->get['CKEditorFuncNum']) ) {
    if ( $json['success'] ) {
        echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction(".$this->request->get['CKEditorFuncNum'].", '/image/data/".$this->request->files['image']['name']."');</script>";
    } else {
        echo $json['error'];
    }
// normal response for default filemanager    
} else {
    $this->load->library('json');
		
    $this->response->setOutput(Json::encode($json));
}