Post by MrMuddy » Mon Nov 08, 2010 10:40 pm

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 !

Attachments

upload_issue.png

Upload dialogue issue - upload_issue.png (19.74 KiB) Viewed 4249 times


--
Tim


Newbie

Posts

Joined
Mon Nov 08, 2010 10:26 pm

Post by clinton4 » Wed Nov 24, 2010 12:08 pm

I have the same problem, did you figure it out?

Spam blocking PHP script, use it!


Active Member

Posts

Joined
Sun Jan 17, 2010 11:54 am

Post by MrMuddy » Wed Nov 24, 2010 4:24 pm

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

--
Tim


Newbie

Posts

Joined
Mon Nov 08, 2010 10:26 pm

Post by Daniel » Wed Nov 24, 2010 5:34 pm

its not happening with me.

try refreshing your browser.

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

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Active Member

Posts

Joined
Sun Jan 17, 2010 11:54 am

Post by Ashura » Fri Jun 24, 2011 11:03 am

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));
}

Newbie

Posts

Joined
Fri Jun 24, 2011 10:44 am
Who is online

Users browsing this forum: No registered users and 210 guests