Log in or register to post comments
Last post
Userfiles Subdirectories using PHP GET ::HELP::
I'm having a problem with trying to get CKFinder to place uploaded files into subdirectories using the php $_GET variable


this is how i have the config set up:


$baseUrl = 'xxxxxx/userfiles/'.$_GET['$DeptId'].'/';
$baseDir = 'xxxxxx/userfiles/'.$_GET['$DeptId'].'/';




can anyone explain to me why this isn't working and/or how to get it working? :cry:
Re: Userfiles Subdirectories using PHP GET ::HELP::
try somwhere in yuor code where you recive $_GET['$DeptId']
session_start();
$_SESSION['DeptId']=$_GET['$DeptId'];

in config.php
session_start();
/*code*/
$baseUrl = 'xxxxxx/userfiles/'.$_SESSION[DeptId'].'/';
Re: Userfiles Subdirectories using PHP GET ::HELP::
DmitriiP wrote:try somwhere in yuor code where you recive $_GET['$DeptId']
session_start();
$_SESSION['DeptId']=$_GET['$DeptId'];

in config.php
session_start();
/*code*/
$baseUrl = 'xxxxxx/userfiles/'.$_SESSION[DeptId'].'/';



tried what you said, but no luck...it's still not working :/


any other suggestions?
Re: Userfiles Subdirectories using PHP GET ::HELP::
i'm trying to create a "userfiles/subdirectory" organization layer in order to codify uploaded file content

i've been scouring these forums for days and haven't really found an adequate way to do this....


is there some other way to achieve the same results? :|
Re: Userfiles Subdirectories using PHP GET ::HELP::
I am doing the same thing (I think). I tried DmitriiP's suggestion and it works fine.

Thanks.
Re: Userfiles Subdirectories using PHP GET ::HELP::
websitedesignby wrote:I am doing the same thing (I think). I tried DmitriiP's suggestion and it works fine.

Thanks.



i don't think i understand the solution clearly then...


could you send me a code snippet from your config.php and the file where you receive the $_GET variable? thanks in advance...
Re: Userfiles Subdirectories using PHP GET ::HELP::
ak.sr wrote:
websitedesignby wrote:I am doing the same thing (I think). I tried DmitriiP's suggestion and it works fine.

Thanks.



i don't think i understand the solution clearly then...


could you send me a code snippet from your config.php and the file where you receive the $_GET variable? thanks in advance...




NVM. I got it working! stupid mistake...i was making syntax errors :roll:




here is my config file:

session_start();
$baseUrl = 'http://xxxxxxxx/userfiles/'.$_SESSION['DeptId'].'/';
$baseDir = '/xxxxxxxxx/userfiles/'.$_SESSION['DeptId'].'/';



and the file where i receive the $_GET variable:

  
<?php
session_start();
$_SESSION['DeptId'] = $_GET['DeptId'];
?>



Cheers!
Re: Userfiles Subdirectories using PHP GET ::HELP::
Make sure that $_GET['DeptId'] is sanitized properly and keep in mind that a hacker might send a fake $_GET['DeptId'].

Wiktor Walc
CTO
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+

Re: Userfiles Subdirectories using PHP GET ::HELP::
Hi all,
I've used a $_SESSION variable to set $baseDir value and it works fine as described before.
The problem is that each time a photo is uploaded the system creates nested subfolders in the thumbs directory (mcith).

I think this is due to the session_start() but can't figure out to solve the problem.

This is my config.php
<?php
session_start();
function CheckAuthentication()
{
   if ((isset($_SESSION['userid'])) && ($_SESSION['userid'] !="")) {
      return true;
   } else { 
      return false;
   }
}
$partefinale = '/images/'.$_SESSION['userid'].'/';
$baseUrl = 'http://xxxx.com'.$partefinale ;
$baseDir = '/var/www/httpdocs'.$partefinale;

$config['Thumbnails'] = Array(
      'url' => $baseUrl . 'mcith',
      'directory' => $baseDir . 'mcith',
      'enabled' => true,
      'directAccess' => false,
      'maxWidth' => 140,
      'maxHeight' => 140,
      'bmpSupported' => false,
      'quality' => 100);

$config['Images'] = Array(
      'maxWidth' => 430,
      'maxHeight' => 930,
      'quality' => 100);

$config['RoleSessionVar'] = 'CKFinder_UserRole';

$config['AccessControl'][] = Array(
      'role' => '*',
      'resourceType' => '*',
      'folder' => '/',

      'folderView' => true,
      'folderCreate' => false,
      'folderRename' => false,
      'folderDelete' => true,

      'fileView' => true,
      'fileUpload' => true,
      'fileRename' => true,
      'fileDelete' => true);

$config['DefaultResourceTypes'] = '';

$config['ResourceType'][] = Array(
      'name' => '/',            // Single quotes not allowed
      'url' => $baseUrl,
      'directory' => $baseDir,
      'maxSize' => '4M',
      'allowedExtensions' => 'gif,jpeg,jpg,png',
      'deniedExtensions' => 'js,php,asp,html,cgi,zip,rar,tar,bat,exe');

$config['CheckDoubleExtension'] = true;

$config['FilesystemEncoding'] = 'UTF-8';

$config['SecureImageUploads'] = true;

$config['CheckSizeAfterScaling'] = true;

$config['HtmlExtensions'] = array('html', 'htm', 'xml', 'js');




Can you help me????

Thanks!