close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dynamic Upload Folder

Thread began 3/14/2011 8:34 am by jon392819 | Last modified 1/24/2012 5:08 pm by info97301 | 2604 views | 15 replies |

jon392819

Dynamic Upload Folder

Hi,

I am about to build a dashboard for business owners to login to allowing them to create offers and discounts. I would like to use html editor as the wysiwyg as it will make it very easy for the non IT bussiness owner to create a nice looking offer. It will also make it easy for them to uload images.

However, is it possible in html editor to not have the upload folder hard coded, instead have it pick up a folder name from a session variable (created on login).

I do not want business owners to see other business owners images.

Any pointers greatfully receaved.

Thanks

Jon

Sign in to reply to this post

Jason ByrnesWebAssist

it will require hand editing the webassist/kfm/configuration.php file.

the lines that sets the upload folder location is:


php:
$kfm_userfiles_address = '../../images/';

$kfm_userfiles_output = 'images/';




this sets the upload location to the images folder of my site, it may be diferant for your site.


you can add a session to the path by changing that to:

php:
if(!session_id()) session_start();

$kfm_userfiles_address = '../../images/'.$_SESSION['userID'];
$kfm_userfiles_output = 'images/'.$_SESSION['userID'];



this is using a session named userID, you can change this to another session if you like.

bear in mind, that this is not a supported modification, you will need to be comfortable editing PHP to get this to work.

Sign in to reply to this post

jon392819

Thats super Jason. Thanks for the solution and quick reply.

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

info97301

Is it possible to have different folders for different areas/users?

For example, I would like the upload folder for 'site administrators' to be ../up/sites/$_SESION['SiteID']
but for users (members of that site) to be ../up/sites/$_SESSION['SiteID']/$_SESSION['MemID']
Images used for a different purpose would be stored in /up/top-pics/
etc etc

Can this be done? If not, could you put it on the wishlist for future releases?

Cheers

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

you would need to hand code the logic to dynamically set the upload folder based on your criteria

Sign in to reply to this post

info97301

Hi JAson

In my configuratio.php file it has:

$kfm_userfiles_address = '../../up/sites/'.$S_SESSION['SiteID'];
$kfm_userfiles_output = rel2abs($kfm_userfiles_address,dirname(__FILE__));

I've changed the first line - what should the second line read - at the moment, uploads go to the 'up' folder, not up/#SiteID

A second issue I have is that when I try to enable security, it says I don nt have security assist andt tries to get me to buy a copy - even though it is installed on the page!

Cheers
Chris

Sign in to reply to this post

Jason ByrnesWebAssist

the second line should not change, but you have a syntax error for the first l;line.


this code:

php:
$kfm_userfiles_address = '../../up/sites/'.$S_SESSION['SiteID'];


should be:

php:
@session_start();
$kfm_userfiles_address = '../../up/sites/'.$_SESSION['SiteID'];




for the other issue, make sure to install the latest version of HTML Editor that is available from the download center.

Sign in to reply to this post

info97301

Hi Jason

Still the same problem.

I got an email from you saying that a support ticket had been raised - but there's nothing in my support area.
Cheers
Chris

Sign in to reply to this post

info97301

Hi Jason

Still no getting anywhere!

The configuration file is as below
Cheers
Chris
---------------------
<?php
$startKFMDir = getcwd();
chdir(dirname(__FILE__));
require_once( "library.php" );
?>
<?php require_once( "../../Connections/connRoSite.php" ); ?>
<?php //Security ?>
<?php chdir($startKFMDir); ?>
<?php
$kfm_hidden_sidebar = false;
if(isset($_GET['showsidebar']) && $_GET['showsidebar'] == 'false') {
$kfm_hidden_sidebar = true;
}
$kfm_db_type = 'mysql';
$kfm_db_prefix = 'kfm_';
$kfm_db_host = $hostname_connRoSite;
$kfm_db_name = $database_connRoSite;
$kfm_db_username = $username_connRoSite;
$kfm_db_password = $password_connRoSite;
$kfm_db_port = '';
$use_kfm_security = false;
$kfm_userfiles_address = '../../up/sites/'.$_SESSION['SiteID'];
$kfm_userfiles_output = rel2abs($kfm_userfiles_address,dirname(__FILE__));
$kfm_workdirectory = '.files-sqlite-pdo';
$kfm_imagemagick_path = '/usr/bin/cnvert';
$kfm_dont_send_metrics = 1;
$kfm_server_hours_offset = 1;

/**
* This function is called in the admin area. To specify your own admin requirements or security, un-comment and edit this function
*/
function kfm_admin_check(){
return false;
}

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...