Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path problem on shared server #10

Open
tolbaruvalentin opened this issue Feb 8, 2016 · 5 comments
Open

Path problem on shared server #10

tolbaruvalentin opened this issue Feb 8, 2016 · 5 comments

Comments

@tolbaruvalentin
Copy link

Ok, your file manager is great and is working fine on localhost , but on server I don't know what is the problem :(

My shared tree from the server in the image below

http://cleverideas.ro/serverarhitecture.jpg

I get this error The directory / does not exist.

The problem is in default.config.php
This line of code :

$folderPath = $app->basePath() . '/public/filemanager/userfiles/';

The code frome default.config.php

`<?php
/**

  • Filemanager PHP connector
  • This file should at least declare auth() function
  • and instantiate the Filemanager as '$fm'
  • IMPORTANT : by default Read and Write access is granted to everyone
  • Copy/paste this file to 'user.config.php' file to implement your own auth() function
  • to grant access to wanted users only
  • filemanager.php
  • use for ckeditor filemanager

// Laravel init
require getcwd() . '/../../../../laravel/bootstrap/autoload.php';
$app = require_once getcwd() . '/../../../../laravel/bootstrap/app.php';

$kernel = $app->make('Illuminate\Contracts\Http\Kernel');

$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);

$id = $app['encrypter']->decrypt($_COOKIE[$app['config']['session.cookie']]);
$app['session']->driver()->setId($id);
$app['session']->driver()->start();

// Folder path
$folderPath = $app->basePath() . '/public_html/filemanager/userfiles/';

// Check if user in authentified
if(!$app['auth']->check())
{
$laravelAuth = false;
}
else
{
// Check if user has all access
if($app['auth']->user()->accessMediasAll())
{
$laravelAuth = true;
}
elseif(method_exists($app['auth']->user(), 'accessMediasFolder'))
{
// Check if user has access to one folder
if($app['auth']->user()->accessMediasFolder())
{
// Folder name with user id
$folderPath .= 'user' . $app['auth']->id();
// Create folder if doesn't exist
if (!is_dir($folderPath))
{
mkdir($folderPath);
}
$laravelAuth = true;
}
else
{
$laravelAuth = false;
}
}
else
{
$laravelAuth = false;
}
}

/**

  • Check if user is authorized
  • @return boolean true if access granted, false if no access
    */
    function auth()
    {
    return $GLOBALS['laravelAuth'];
    }

$fm = new Filemanager();

$fm->setFileRoot($folderPath);

?>`

@bestmomo
Copy link
Owner

bestmomo commented Feb 9, 2016

Hi,

Try this, in filemanager/connectors/php/default.config.php :

// Folder path
$folderPath = $app->publicPath() . '/'. config('filemanager.folder_path');   
$folderPath = str_replace('\\', '/', $folderPath); 

and in filemanager/scripts/filemanager.config.js :

"baseUrl": "/",

Tell me if it works for you.

@tolbaruvalentin
Copy link
Author

Thanks for the response, I have changed with you said but still is not working. I have putted this code
$folderPath = $_SERVER['DOCUMENT_ROOT'] . '/filemanager/userfiles/'. config('filemanager.folder_path');
and is working , it is showing the folder with pictures it makes the uploads and puts the paths well.

But on other hosting server for another site , is still working , but is not showing the picture in url :
for example : http://www.sitename.com/filemanager/userfiles/myphoto.jpg , but the picture exists in the folder

@bestmomo
Copy link
Owner

bestmomo commented Feb 9, 2016

So that means that publicPath() doesn't work in this case of "public_html".

@tolbaruvalentin
Copy link
Author

So that means that publicPath() doesn't work in this case of "public_html".

In my case yes.

@SeifBh
Copy link

SeifBh commented May 26, 2016

$folderPath = 'youdomainname.com/filemanager/userfiles/'. config('filemanager.folder_path');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants