I desperatly need help to have dynamically created upload subdirectories based on my users UserId's.
My system works on Apache with Php 5, and my ckeditor/finder are located on pages where each user can post their own stories (so, their UserId's are associated with the stories).
I tried to implement all the "solutions" I read here and there on this forum and others, nothing worked.
I posted the code from my previous (obsolete) wysiwyg, that dealt with creating such subdirectories. This code comes from my class.user.php file (loaded when a user wants to create an article).
Anybody would know how to do it? I am willing to send a payment via Paypal.
Thank you.
My system works on Apache with Php 5, and my ckeditor/finder are located on pages where each user can post their own stories (so, their UserId's are associated with the stories).
I tried to implement all the "solutions" I read here and there on this forum and others, nothing worked.
I posted the code from my previous (obsolete) wysiwyg, that dealt with creating such subdirectories. This code comes from my class.user.php file (loaded when a user wants to create an article).
Anybody would know how to do it? I am willing to send a payment via Paypal.
Thank you.
// specific directories if ($GLOBALS["AL_CFG"]["UseSeperateImgDirs"]) { $base = dirname(dirname(dirname(dirname(__file__)))); // Handle the content_images directory $dir = sprintf("%s/content_images/%d", $base, $userId); if (is_dir($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { if ($file == "." || $file == "..") { continue; } if (!is_file("$dir/$file")) { continue; } @unlink("$dir/$file"); } closedir($dh); @rmdir($dir); }
Re: Dynamically created Images upload subdirectories - Help
Have you tried creating baseDir / baseUrl helper variables using session variables?
those variables may be changed anywhere in your application as long as you have session_start() at the top of your scripts.
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Dynamically created Images upload subdirectories - Help
Wiktor, thanks for your help. This is not enough detailed for me (I am not a programmer).
Here is my config so far :
At the top:
<?php
session_start();
Then:
$baseDir = '../../../../i/';
$baseUrl = 'http://www.MyWebSite.com/i/';
Bottom:
'url' => $baseUrl . '1',
'directory' => $baseDir . '1',
So the way it works now, my images are (and the links points) to:
http://www.MyWebSite.com/i/1/
I want to save and point to:
http://www.MyWebSIte.com/i/UserId (number) /
Could you explain more what I should change here and elsewhere, if needed?
I would appreciate.