elFinder error "Unable to connect to backend. Backend not found." - php

I'm starting to work with elFinder and I don't know why but I get this error "Unable to connect to backend.Backend not found.". The connector.php looks like this
$opts = array(
// 'debug' => true,
'roots' => array(
array(
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
'path' => '../files/', // path to files (REQUIRED)
'URL' => dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED)
'uploadDeny' => array('all'), // All Mimetypes not allowed to upload
'uploadAllow' => array('image', 'text/plain'),// Mimetype `image` and `text/plain` allowed to upload
'uploadOrder' => array('deny', 'allow'), // allowed Mimetype `image` and `text/plain` only
'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL)
)
)
);
And the path to the file is: myproject >> dashboard >> plugins >> elfinder . What can I do to solve the problem with backend connection?

It is HTTP error "404 Not Found". Please check your connector URL.

Related

set dynamic path elfinder

i'm using elfinder and i want to set path with php var (from my db connection)
here the array from my connector
include_once('../../include/header.php');
$CustomerUniqueCode=$InfoG->customer_unique_secure_code;
error_reporting(0); // Set E_ALL for debuging
require './autoload.php';
// ===============================================
function access($attr, $path, $data, $volume) {
return strpos(basename($path), '.') === 0 // if file/folder begins with '.' (dot)
? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true
: null; // else elFinder decide it itself
}
$opts = array(
//'debug' => true,
'roots' => array(
array(
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
'path' => '../../folder/customer/'.$CustomerUniqueCode.'/files/', // path to files (REQUIRED)
'URL' => dirname($_SERVER['PHP_SELF']) . '../../folder/customer/'.$CustomerUniqueCode.'/files/', // URL to files (REQUIRED)
'tmbPath' => '../files/thumbnails/',
'tmbURL' => dirname($_SERVER['PHP_SELF']) . '/../files/thumbnails',
'uploadDeny' => array('all'), // All Mimetypes not allowed to upload
'uploadAllow' => array('image', 'text/plain'),// Mimetype `image` and `text/plain` allowed to upload
'uploadOrder' => array('deny', 'allow'), // allowed Mimetype `image` and `text/plain` only
'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL)
)
)
);
// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();
The error message is :
Invalid backend configuration.
Readable volumes not available.
display_file.php including elfinder.php
Here the server organisation
Someone can help me ?

KCFinder in CKEditor showing HTTP 500 error on hosting server

In one of my Codeigniter v3.1.3 project, i have used 'KCFinder' in CKEditor for uploading images to the server. The directory structure of my localhost version of the project is:
localhost/project_ci
--application
--assets
----admin
------ckeditor
------kcfinder
--system
--index.php
Initially i was having difficulty integrating KCFinder with CKEditor but after searching the internet, i came across a tutorial(i don't rember the url now) explaining the steps to integrate it.I followed the steps mentioned there and now it works perfectly on localhost.The step1 of the said tutorial was to change some values of index.php in the root directory as:
$system_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'system';
$application_folder = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'application';
Now i have uploaded the above project in a Shared Hosting server.In the hosting server, the files are organized as follows:
/home/myaccount
--ci_top_secret
----application
----system
--public_html
----assets
----index.php
and the system_path values in index.php are:
$system_path = '../ci_top_secret/system';
$application_folder = '../ci_top_secret/application';
My website works well, all the CKEditor's are visible.However in the 'image properties' popup when i click the 'Browse Server' button, a blank page appear showing HTTP 500 error.Hence i am not able to upload images to the remote server.I really don't understand what is wrong.Is it because of the system_path values in the index.php.Please advise with some code.Thanks
Inside KC-Finder you will find the folder conf folder
keep these file
config.php
<?php
/** This file is part of KCFinder project
*
* #desc Base configuration file
* #package KCFinder
* #version 3.12
* #author Pavel Tzonkov <sunhater#sunhater.com>
* #copyright 2010-2014 KCFinder Project
* #license http://opensource.org/licenses/GPL-3.0 GPLv3
* #license http://opensource.org/licenses/LGPL-3.0 LGPLv3
* #link http://kcfinder.sunhater.com
*/
/* IMPORTANT!!! Do not comment or remove uncommented settings in this file
even if you are using session configuration.
See http://kcfinder.sunhater.com/install for setting descriptions */
if ($_SERVER['SERVER_NAME'] == 'localhost' || strstr($_SERVER['SERVER_NAME'], '172.16')) {
$upload_url = "upload";
$upload_dir = "";
} else if ($_SERVER['HTTP_HOST'] == "216.55.169.45") {
$upload_url = "http://216.55.169.45/~mpdriver/master/assets/admin/kcfinder/upload";
$upload_dir = "/home/mpdriver/public_html/master/assets/admin/kcfinder/upload";
} else {
$upload_url = "upload";
$upload_dir = "";
}
$_CONFIG = array(
// GENERAL SETTINGS
'disabled' => FALSE,
'uploadURL' => "upload",
'uploadDir' => "",
'theme' => "default",
'types' => array(
// (F)CKEditor types
'files' => "",
'flash' => "swf",
'images' => "*img",
// TinyMCE types
'file' => "",
'media' => "swf flv avi mpg mpeg qt mov wmv asf rm",
'image' => "*img",
),
// IMAGE SETTINGS
'imageDriversPriority' => "imagick gmagick gd",
'jpegQuality' => 90,
'thumbsDir' => ".thumbs",
'maxImageWidth' => 0,
'maxImageHeight' => 0,
'thumbWidth' => 100,
'thumbHeight' => 100,
'watermark' => "",
// DISABLE / ENABLE SETTINGS
'denyZipDownload' => false,
'denyUpdateCheck' => false,
'denyExtensionRename' => false,
// PERMISSION SETTINGS
'dirPerms' => 0755,
'filePerms' => 0644,
'access' => array(
'files' => array(
'upload' => true,
'delete' => true,
'copy' => true,
'move' => true,
'rename' => true
),
'dirs' => array(
'create' => true,
'delete' => true,
'rename' => true
)
),
'deniedExts' => "exe com msi bat cgi pl php phps phtml php3 php4 php5 php6 py pyc pyo pcgi pcgi3 pcgi4 pcgi5 pchi6",
// MISC SETTINGS
'filenameChangeChars' => array(/*
' ' => "_",
':' => "."
*/),
'dirnameChangeChars' => array(/*
' ' => "_",
':' => "."
*/),
'mime_magic' => "",
'cookieDomain' => "",
'cookiePath' => "",
'cookiePrefix' => 'KCFINDER_',
// THE FOLLOWING SETTINGS CANNOT BE OVERRIDED WITH SESSION SETTINGS
'_normalizeFilenames' => false,
'_check4htaccess' => true,
//'_tinyMCEPath' => "/tiny_mce",
'_sessionVar' => "KCFINDER",
//'_sessionLifetime' => 30,
//'_sessionDir' => "/full/directory/path",
//'_sessionDomain' => ".mysite.com",
//'_sessionPath' => "/my/path",
//'_cssMinCmd' => "java -jar /path/to/yuicompressor.jar --type css {file}",
//'_jsMinCmd' => "java -jar /path/to/yuicompressor.jar --type js {file}",
);
?>
and also check your URL Pointings also.

Jquery file upload php

I got an problem with my file uploader it gives me an SyntaxError: Unexpected token < ...
I dont know where it is coming from and i have been looking for a day now but cant seem to find an answer can someone give me some advice. (some photo's do upload and when it gives that error it only doesnt make a thumbnail hope that helps.
i think the error is somewhere down here.
thanks in advanced
<?php
/*
* jQuery File Upload Plugin PHP Class 8.2.3
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
class UploadHandler
{
protected $options;
// PHP File Upload error message codes:
// http://php.net/manual/en/features.file-upload.errors.php
protected $error_messages = array(
1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
3 => 'The uploaded file was only partially uploaded',
4 => 'No file was uploaded',
6 => 'Missing a temporary folder',
7 => 'Failed to write file to disk',
8 => 'A PHP extension stopped the file upload',
'post_max_size' => 'The uploaded file exceeds the post_max_size directive in php.ini',
'max_file_size' => 'File is too big',
'min_file_size' => 'File is too small',
'accept_file_types' => 'Filetype not allowed',
'max_number_of_files' => 'Maximum number of files exceeded',
'max_width' => 'Image exceeds maximum width',
'min_width' => 'Image requires a minimum width',
'max_height' => 'Image exceeds maximum height',
'min_height' => 'Image requires a minimum height',
'abort' => 'File upload aborted',
'image_resize' => 'Failed to resize image'
);
protected $image_objects = array();
function __construct($options = null, $initialize = true, $error_messages = null) {
$this->response = array();
$this->options = array(
'script_url' => $this->get_full_url().'/index.php?'.$_SERVER['QUERY_STRING'].'&',
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/uploaddir/',
'upload_url' => $this->get_full_url().'/uploaddir/',
//'user_dirs' => false,
'user_dirs' => true,
'mkdir_mode' => 0755,
'param_name' => 'files',
// Set the following option to 'POST', if your server does not support
// DELETE requests. This is a parameter sent to the client:
//'delete_type' => 'DELETE',
'delete_type' => 'POST',
'access_control_allow_origin' => '*',
'access_control_allow_credentials' => false,
'access_control_allow_methods' => array(
'OPTIONS',
'HEAD',
'GET',
'POST',
'PUT',
'PATCH',
'DELETE'
),
'access_control_allow_headers' => array(
'Content-Type',
'Content-Range',
'Content-Disposition'
),
// Enable to provide file downloads via GET requests to the PHP script:
// 1. Set to 1 to download files via readfile method through PHP
// 2. Set to 2 to send a X-Sendfile header for lighttpd/Apache
// 3. Set to 3 to send a X-Accel-Redirect header for nginx
// If set to 2 or 3, adjust the upload_url option to the base path of
// the redirect parameter, e.g. '/files/'.
'download_via_php' => false,
// Read files in chunks to avoid memory limits when download_via_php
// is enabled, set to 0 to disable chunked reading of files:
'readfile_chunk_size' => 100 * 1024 * 1024, // 10 MiB
// Defines which files can be displayed inline when downloaded:
'inline_file_types' => '/\.(gif|jpe?g|png)$/i',
// Defines which files (based on their names) are accepted for upload:
'accept_file_types' => '/.+$/i',
// The php.ini settings upload_max_filesize and post_max_size
// take precedence over the following max_file_size setting:
'max_file_size' => null,
'min_file_size' => 1,
// The maximum number of files for the upload directory:
'max_number_of_files' => null,
// Defines which files are handled as image files:
'image_file_types' => '/\.(gif|jpe?g|png)$/i',
// Use exif_imagetype on all files to correct file extensions:
'correct_image_extensions' => false,
// Image resolution restrictions:
'max_width' => null,
'max_height' => null,
'min_width' => 1,
'min_height' => 1,
// Set the following option to false to enable resumable uploads:
'discard_aborted_uploads' => true,
// Set to 0 to use the GD library to scale and orient images,
// set to 1 to use imagick (if installed, falls back to GD),
// set to 2 to use the ImageMagick convert binary directly:
'image_library' => 1,
// Uncomment the following to define an array of resource limits
// for imagick:
/*
'imagick_resource_limits' => array(
imagick::RESOURCETYPE_MAP => 32,
imagick::RESOURCETYPE_MEMORY => 32
),
*/
// Command or path for to the ImageMagick convert binary:
'convert_bin' => 'convert',
// Uncomment the following to add parameters in front of each
// ImageMagick convert call (the limit constraints seem only
// to have an effect if put in front):
/*
'convert_params' => '-limit memory 32MiB -limit map 32MiB',
*/
// Command or path for to the ImageMagick identify binary:
'identify_bin' => 'identify',
'image_versions' => array(
// The empty image version key defines options for the original image:
'' => array(
// Automatically rotate images based on EXIF meta data:
'auto_orient' => false
),
// Uncomment the following to create medium sized images:
'medium' => array(
'max_width' => 800,
'max_height' => 600
),
'thumbnail' => array(
// Uncomment the following to use a defined directory for the thumbnails
// instead of a subdirectory based on the version identifier.
// Make sure that this directory doesn't allow execution of files if you
// don't pose any restrictions on the type of uploaded files, e.g. by
// copying the .htaccess file from the files directory for Apache:
//'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/medium/',
//'upload_url' => $this->get_full_url().'/medium/',
// Uncomment the following to force the max
// dimensions and e.g. create square thumbnails:
'crop' => true,
'max_width' => 800,
'max_height' => 600
)
),
'print_response' => true
);
if ($options) {
$this->options = $options + $this->options;
}
if ($error_messages) {
$this->error_messages = $error_messages + $this->error_messages;
}
if ($initialize) {
$this->initialize();
}
}
Where is the error coming from. Did you check your php logs.
1. This by default will be in the php error logs.
2. Tail the logs and run the call again, you should get the line number and shoot that bugger.
Hope that helps
This error means that in ajax response we get line with wrong JSON syntax, i.e. some '<'.
To be sure try this: in javascript delete dataType:'json' and in the function success add something like this (don't forget press ctrl+shift+j if you use google Chrome to see result of console.log()):
success: function(data){
console.log(data);
// alert(data);
}

jQuery-File-Upload not creating thumbnail file after uploading on server

I am using jQuery-File-Upload (basic version) to upload file on server using jQuery. My original image file is uploading successfully but it is not uploading the thumbnail file into thumbnail folder.
I also set the write permission on this folder. But same code on my localhost is working fine, after uploading on server it is not creating thumbnail.
jQuery.each(data.result.files, function (index, file) {
alert(file.thumbnailUrl);
This alert message is showing blank on server. but on localhost showing uploaded path perfectly.
My UploadHandler.php __construct() Code is :-
function __construct($options = null, $initialize = true, $error_messages = null) {
$this->options = array(
'script_url' => $this->get_full_url().'/',
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'../../../../../../temp/',
'upload_url' => $this->get_full_url().'../../../../../../temp/',
'user_dirs' => false,
'mkdir_mode' => 0755,
'param_name' => 'files',
// Set the following option to 'POST', if your server does not support
// DELETE requests. This is a parameter sent to the client:
'delete_type' => 'DELETE',
'access_control_allow_origin' => '*',
'access_control_allow_credentials' => false,
'access_control_allow_methods' => array(
'OPTIONS',
'HEAD',
'GET',
'POST',
'PUT',
'PATCH',
'DELETE'
),
'access_control_allow_headers' => array(
'Content-Type',
'Content-Range',
'Content-Disposition'
),
// Enable to provide file downloads via GET requests to the PHP script:
// 1. Set to 1 to download files via readfile method through PHP
// 2. Set to 2 to send a X-Sendfile header for lighttpd/Apache
// 3. Set to 3 to send a X-Accel-Redirect header for nginx
// If set to 2 or 3, adjust the upload_url option to the base path of
// the redirect parameter, e.g. '/files/'.
'download_via_php' => false,
// Read files in chunks to avoid memory limits when download_via_php
// is enabled, set to 0 to disable chunked reading of files:
'readfile_chunk_size' => 10 * 1024 * 1024, // 10 MiB
// Defines which files can be displayed inline when downloaded:
'inline_file_types' => '/\.(gif|jpe?g|png)$/i',
// Defines which files (based on their names) are accepted for upload:
'accept_file_types' => '/.+$/i',
// The php.ini settings upload_max_filesize and post_max_size
// take precedence over the following max_file_size setting:
'max_file_size' => null,
'min_file_size' => 1,
// The maximum number of files for the upload directory:
'max_number_of_files' => null,
// Image resolution restrictions:
'max_width' => null,
'max_height' => null,
'min_width' => 1,
'min_height' => 1,
// Set the following option to false to enable resumable uploads:
'discard_aborted_uploads' => true,
// Set to false to disable rotating images based on EXIF meta data:
'orient_image' => true,
'image_versions' => array(
// Uncomment the following version to restrict the size of
// uploaded images:
/*
'' => array(
'max_width' => 1920,
'max_height' => 1200,
'jpeg_quality' => 95
),
*/
// Uncomment the following to create medium sized images:
'medium' => array(
'max_width' => 400,
'max_height' => 400,
'jpeg_quality' => 80
),
'thumbnail' => array(
// Uncomment the following to use a defined directory for the thumbnails
// instead of a subdirectory based on the version identifier.
// Make sure that this directory doesn't allow execution of files if you
// don't pose any restrictions on the type of uploaded files, e.g. by
// copying the .htaccess file from the files directory for Apache:
//'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'../../../../../../thumbnail/',
//'upload_url' => $this->get_full_url().'../../../../../../thumbnail/',
// Uncomment the following to force the max
// dimensions and e.g. create square thumbnails:
//'crop' => true,
'max_width' => 80,
'max_height' => 80
)
)
);
if ($options) {
$this->options = array_merge($this->options, $options);
}
if ($error_messages) {
$this->error_messages = array_merge($this->error_messages, $error_messages);
}
if ($initialize) {
$this->initialize();
}
}

Unabled to upload load "file", permission denied

i use elfinder to upload file throught FTP driver, but i can not upload file to server, elfinder show messagers dialog "unabled to upload file, permission denied". I have take owership for the user use FTP but not affected:(, please help me
$newname should be full path to a new file. But in your script it is a relative path that seems to point somewhere inside /tmp
I solved this problem by adding extra configurations to elfinder root. For example:
$root = array(
// -------------------------------
'driver' => 'FTP',
'host' => 'ftp_ip',
'user' => 'username',
'pass' => 'password',
// -------------------------------
'port' => 21,
'mode' => 'passive',
'alias' => 'folder_alias,
'owner' => true,
'tmbPath' => '/tmp',
'tmpPath' => '/tmp',
'dirMode' => 0777,
'fileMode' => 0777
);

Categories