• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI + tinyMce editor + tinybrowser file uploader

#1
[eluser]amipaxs[/eluser]
hi,

I use the following directory tree on the server , i used to get error status 404 when uploading files through tinybrowser, even though i could create folders inside the media folder. I deleted .htaccess file
so i'm using index.php again on the URL , now i get error 406 during the upload process.

-css
-images
-js
---tinyMce(editor)
----plugins
-----tinybrowser
-media (upload directory -777 permission)
--thumbs
-system (ci files)
.htaccess
index.php


any ideas ??

#2
[eluser]umefarooq[/eluser]
have u check the tinybrowser config file with the name config_tinybrowser.php where you can find the file upload path which tinybrowser automatically creating when you call it if directory not exists.

Code:
$tinybrowser['path']['image'] = '/useruploads/images/'; // Image files location - also creates a '_thumbs' subdirectory within this path to hold the image thumbnails
$tinybrowser['path']['media'] = '/useruploads/media/'; // Media files location
$tinybrowser['path']['file']  = '/useruploads/files/'; // Other files location

another thing also share .htaccess file

#3
[eluser]arjo[/eluser]
Hi,

I have also a (path) problem with CI + tinyMCE + tinyBrowser.
Here is the relevant part of my config_tinybrowser.php:
Code:
$tinybrowser['docroot'] = '/home/vakgroep/algemeen/fed/';

$tinybrowser['path']['image'] = '/upload/images/'; // Image files location
$tinybrowser['path']['media'] = '/upload/media/'; // Media files location
$tinybrowser['path']['file']  = '/upload/files/'; // Other files location

When I upload an image (sander.jpg) using tinybrowser, the file is created on the server:
/home/vakgroep/algemeen/fed/upload/images/sander.jpg
So far so good. But the image does not appear in the browse list of the tinybrowser dialog window. And after insert into a document, timyMCE f*cks up my path creating in the html:
Code:
<img src="../../../../upload/images/sander.jpg">

Here's my .htaccess as well:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|upload|captcha|css|js|robots\.txt)
RewriteRule ^(.*)$ /fed/index.php/$1 [L]

As you can see, the folder upload is listed as an execption for the rewrite and CI will leave it alone.

I think it has something todo with the absolute path; the upload and subdir creation is working fine, but showing images and thumbs and referring to them is NOT working. I wish I could use the CI function base_url() to fix this but I don't know where to do this...

Anyone having problems like mentioned above? And a solution?

many thanks in advance,

Arjo

#4
[eluser]umefarooq[/eluser]
now here is the solution of your problem you have to set some values in you tinymce_config.js

Code:
remove_script_host : false,
        relative_urls : false,
        document_base_url : "http://www.yorsite.come/",

        or
        
        document_base_url : "http://localhost/yoursite/"

then your image path will be like
Code:
<img src="http://www.yorsite.come/upload/images/sander.jpg">

and let you tinybrowser setting as it is
Code:
$tinybrowser['docroot'] = $_SERVER['DOCUMENT_ROOT'];

if you have any trouble just post your comment here ill check this for more help you can check tinymce doc

http://wiki.moxiecode.com/index.php/Tiny...figuration

#5
[eluser]amipaxs[/eluser]
hi thanks for answering my post,
here are more deatils about my settings:

tinybrowser_config.php:

$tinybrowser['integration'] = 'tinymce';
$tinybrowser['docroot'] = '/home/rcab09/public_html';
$tinybrowser['unixpermissions'] = 0777;
$tinybrowser['path']['image'] = '/media/images/'; (777 permissions)
$tinybrowser['link']['image'] = $tinybrowser['path']['image'];


my .htaccess is

RewriteEngine on
RewriteCond $1 !^(index\.php|images|captcha|css|js|uploads|media|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]


by the way, $_SERVER['DOCUMENT_ROOT'] produced /usr/local/htdocs in my virtualhost.


i'm attaching a pic about the error with .htaccess, without .htaccess it produces error 406, then could it be mod_security the culprit?

#6
[eluser]amipaxs[/eluser]
umefarooq , could not find tinymce_config.js,, do you mean my settings in the controller? i'll test your suggestions here.

tinymce settings in the controller ,

$this->tinyMce = '
&lt;!-- TinyMCE --&gt;
call javascript 1: script type="text/javascript" src="'.base_url().'js/tiny_mce/tiny_mce.js"
call javascript 2: script type="text/javascript" src="'.base_url().'js/tiny_mce/plugins/tinybrowser/tb_tinymce.js.php

script type="text/javascript"
tinyMCE.init({
//General option
mode : "textareas",
theme : "advanced",
plugins: "table,contextmenu,advimage,advlink,paste,fullscreen,xhtmlxtras,preview",
theme_advanced_toolbar_align: "left",
theme_advanced_buttons1: "formatselect,outdent,indent,seperator,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",
theme_advanced_buttons2: "justifyleft,justifycenter,justifyright,justifyfull,|,bold,italic,separator,bullist,numlist,link,separator,imagepopup,table,separator,sub,sup",
theme_advanced_buttons3: "preview",
theme_advanced_toolbar_location: "top",
theme_advanced_path_location : "bottom",
theme_advanced_resizing : true,
content_css : "'. base_url().'/css/editable.css",
theme_advanced_blockformats : "p",
file_browser_callback : "tinyBrowser"

});
[removed]
&lt;!-- /TinyMCE --&gt;
';

}

#7
[eluser]umefarooq[/eluser]
you have to put following line of code in tinyMCE.init along with you rest of settings. sorry for the file i have created tinymce_conf.js separate which is keeping only tinMCE.init

Code:
tinyMCE.init({
remove_script_host : false,
        relative_urls : false,
        document_base_url : "http://www.yorsite.come/",

        or
        
        document_base_url : "http://localhost/yoursite/"
)};

#8
[eluser]arjo[/eluser]
[quote author="umefarooq" date="1251888704"]now here is the solution of your problem you have to set some values in you tinymce_config.js

Code:
remove_script_host : false,
        relative_urls : false,
        document_base_url : "http://www.yorsite.come/",

        or
        
        document_base_url : "http://localhost/yoursite/"

then your image path will be like
Code:
<img src="http://www.yorsite.come/upload/images/sander.jpg">

and let you tinybrowser setting as it is
Code:
$tinybrowser['docroot'] = $_SERVER['DOCUMENT_ROOT'];

if you have any trouble just post your comment here ill check this for more help you can check tinymce doc

http://wiki.moxiecode.com/index.php/Tiny...figuration[/quote]

Hi,

When I use the code above, the select after clicking the thumbnail doesn't work anymore so the browser dialog isn't closed and the image isn't transferred into the tinymce textarea html...

What I do now is convert the path '../../../..' to 'base_url()' using the function str_replace in my php model script where I save the content to the database.

But thanks anyway!

Arjo

#9
[eluser]amipaxs[/eluser]
Solved!

It was all related to a server configuration blocking the upload, now I use a dedicated server and it works perfectly!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.