Welcome Guest, Not a member yet? Register   Sign In
Elfinder 403 problems
#1

[eluser]Unknown[/eluser]
Hi guys,

I've been using CI for a while but still have some difficulties from time to time, but this time I can't really figure it out.

I'm trying to get Elfinder (file manager) to work with Codeigniter and I've done the following.

File manager controller (controllers/documents)

Code:
/* inline scripts related to this page */
$this->load->view('_inline_scripts/_documents');

File manager jquery script (views/_inline_scripts/_documents)

Code:
[removed]
$().ready(function(){
  var elf = $('#elfinder').elfinder({
   url : '<?php echo base_url(). "application/controllers/ex_cont/elfinder_init" ?>',
   rememberLastDir : true,
   lang : 'sv',
   height : '600'
  }).elfinder('instance');
});
[removed]

File manager controller (controllers/ex_cont/elfinder_init)

Code:
<?php
function elfinder_init()
{
  $this->load->helper('path');
  $opts = array(
    // 'debug' => true,
    'roots' => array(
      array(
        'driver' => 'LocalFileSystem',
        'path'   => set_realpath('filesystem'),
        'URL'    => site_url('filesystem') . '/'
        // more elFinder options here
      )
    )
  );
  $this->load->library('elfinder_lib', $opts);
}


File manager library (lib/Elfinder_lib)


Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elfinder/elFinderConnector.class.php';
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elfinder/elFinder.class.php';
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elfinder/elFinderVolumeDriver.class.php';
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elfinder/elFinderVolumeLocalFileSystem.class.php';

class Elfinder_lib
{
  public function __construct($opts)
  {
    $connector = new elFinderConnector(new elFinder($opts));
    $connector->run();
  }
}

And the error I get is:
Can't connect to back-end
Permissions denied

And if I check firebug I get the following:
Quote:http://localhost/NovaCloud/application/c...7590387888

Quote:<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
&lt;html&gt;&lt;head>
&lt;title&gt;403 Forbidden&lt;/title&gt;
&lt;/head&gt;&lt;body>
<h1>Forbidden</h1>
<p>You don't have permission to access /NovaCloud/application/controllers/ex_cont/elfinder_init
on this server.</p>
&lt;/body&gt;&lt;/html>

Any ideas how to fix this? I guess it has something to do with my rewrite rules?

Thanks in advance!

#2

[eluser]Unknown[/eluser]
Solved

By moving the content from ex_cont and place the function elfinder_init() in our controllers/documents instead and from our _documents.php view file we call

Code:
var elf = $('#elfinder').elfinder({
   url : '&lt;?php echo base_url(). "index.php/Documents/elfinder_init" ?&gt;',
   rememberLastDir : true,
   lang : 'sv',
   height : '600'
  }).elfinder('instance');

Now everything is working like it should =)




Theme © iAndrew 2016 - Forum software by © MyBB