Jump to content

file upload in tinymce


Recommended Posts

I and getting a syntax error when trying to upload files from within the TinyMCE HTML editor. The error is...

 

"SyntaxError: missing ; before statement"

 

Does anyone know of a solution to this?

 

I have tried with the latest versions of FF and IE, I am using PS 1.4.3

post-260942-0-46741300-1312627089_thumb.jpg

Link to comment
Share on other sites

This appears to be a mod_security issue with TinyMCE and its ajax file manager.

 

My hosts were able to comment out some of the config settings and this seems to have resolved the problem, although I am uncomfortable that mod_security needed to be changed!

Link to comment
Share on other sites

  • 1 month later...

Just encountered this myself with a client. Unfortunately the ajax file manager relies on "../" in file paths passed via GET requests and this triggers mod_security's path traversal checks. Still looking to see if the there is a config option than can be used to get around this limitation (disabling mod_security is NOT a viable solution).

 

[EDIT]

 

After digging a bit I see this is caused by a the ajax file manager wanting a relative path in

 

[admin dir]/ajaxfilemanager/inc/config.base.php

 

line 51:

 

//check if folder exist
   if (!is_dir('../../some/dir'))
    mkdir('../../some/dir');

   define('CONFIG_SYS_DEFAULT_PATH', '../../some/dir'); //accept relative path only
   define('CONFIG_SYS_ROOT_PATH', '../../some/dir');    //accept relative path only

 

Unfortunately the way these values are used looks like it will be a significant hack to correct this behaviour.

 

Cheers

Link to comment
Share on other sites

  • 4 months later...

It is not a solution but allows to upload my files.

(see attachment)

 

I've found the script online and have integrated in ajaxfilemanager.php, also with its stylesheet.

 

Download attachment for PS. 1.4.6.2:

1) only the script for uploding files (insert anywere you want in your ajafilemanager.php original or in anywere you want appears)

2) ajaxfilemanager complete hack (like you see in image - no need to do anything, just edit italian language)

 

sorry for my english

post-248300-0-59661100-1329161419_thumb.png

ajaxfilemanager.php

upload-files.php

Link to comment
Share on other sites

  • 3 months later...

Another possible solution is the direct editing of files /admin/ajaxfilemanager/inc/config.base.php.

 

Find the comment (near line 51):

 

//check if folder exist

 

and replace the code that follows, that is::

 

//check if folder exist
define('CONFIG_SYS_MY_DOCROOT', $_SERVER['DOCUMENT_ROOT'] . implode('/',array_slice(explode('/',$_SERVER['PHP_SELF']),0,-6)));
if (!is_dir('../../img/cms'))
	mkdir('../../img/cms');

define('CONFIG_SYS_DEFAULT_PATH', '../../img/cms'); //accept relative path only
define('CONFIG_SYS_ROOT_PATH', '../../img/cms');	//accept relative path only

 

Replace with:

 

//check if folder exist
define('CONFIG_SYS_MY_DOCROOT', $_SERVER['DOCUMENT_ROOT'] . implode('/',array_slice(explode('/',$_SERVER['PHP_SELF']),0,-6)));
if (!is_dir(CONFIG_SYS_MY_DOCROOT.'/ROOT-PS/img/cms/'))
mkdir(CONFIG_SYS_MY_DOCROOT.'/ROOT-PS/img/cms/');
define('CONFIG_SYS_MY_DOCROOT', $_SERVER['DOCUMENT_ROOT'] . implode('/',array_slice(explode('/',$_SERVER['PHP_SELF']),0,-6)));
define('CONFIG_SYS_DEFAULT_PATH', CONFIG_SYS_MY_DOCROOT.'/ROOT-PS/img/cms/');
define('CONFIG_SYS_ROOT_PATH', CONFIG_SYS_MY_DOCROOT.'/ROOT-PS/img/cms/');

 

Taking care to replace PS-ROOT with the directory where your Prestashop is installed.

 

Bug: after the change, you need to manually update the display of the filemanager

 

updateajaxfilemanager.png

 

Always have a backup

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...