Issues with SES

Luis,

I am having some issues with SES. Typically, I use TinyFCK (http://p4a.crealabsfoundation.org/tinyfck) for CMS applications so that clients can upload their own images and insert them into the form. Unfortunately, with the 2.5 RC2 when I browse for a file and click upload I get the following error in the AJAX response (looking at Net->Response in Firebug):

Framework Initialization/Configuration Exception

Error Type: interceptors.ses.executingConfigException : [N/A]
Error Messages: Error including config file: The filename, directory name, or volume label syntax is incorrect

Tag Context:

ID:

CFTHROW

LINE:

265

Template:

C:\wwwroot\northeast\coldbox\system\frameworkSupertype.cfc

ID:

CF_UDFMETHOD

LINE:

43

Template:

C:\wwwroot\northeast\coldbox\system\interceptors\ses.cfc

ID:

CF_TEMPLATEPROXY

LINE:

63

Template:

C:\wwwroot\northeast\coldbox\system\services\interceptorService.cfc

ID:

CF_TEMPLATEPROXY

LINE:

95

Template:

C:\wwwroot\northeast\coldbox\system\services\loaderService.cfc

ID:

CF_UDFMETHOD

LINE:

37

Template:

C:\wwwroot\northeast\coldbox\system\services\loaderService.cfc

ID:

CF_TEMPLATEPROXY

LINE:

67

Template:

C:\wwwroot\northeast\coldbox\system\coldbox.cfc

ID:

CF_UDFMETHOD

LINE:

47

Template:

C:\wwwroot\northeast\admin\Application.cfc

I just downloaded FCKEditor and installed it in /admin/includes/fckeditor and tested it by going to the following url:

http://localhost/admin/includes/fckeditor/editor/filemanager/connectors/uploadtest.html

When I select ColdFusion and then try and upload an image I get the same error as before with tinyFCK. You may want to replicate this setup and check this bug for yourself.

-Aaron

Are you in configAutoReload mode?

If the app is running, why would the interceptor fire its configuration again?

I would need to see code

Interesting…

I changed configAutoReload to false and now the page is coming up as expected. Unfortunately, however, I am getting the following error message:

Error creating folder “C:\JRun4\bin\redirect:\index.cfm\userfiles\image\image” (The specified directory attribute value C:\JRun4\bin\redirect:\index.cfm\userfiles\image\image\ could not be created.)

I’m using “/userfiles/images” as the path. This should place it in the root and would work fine except that the SES is doing something else.

I have tried several paths including some system functions but I cannot get it to work unless I hard code the physical path “c:\wwwroot\northeast\userfiles\images”

If anything jumps out at you please let me know, I’m out of guesses.

Thanks,
Aaron

The error I am now getting is very much like the error I was getting before when trying to access /admin with the default .htaccess settings (before I removed a line from it). I have tried putting my modified .htaccess file in every directory of fckeditor but that is not working. I have also tried the same thing with the default .htaccess file but that does not work (when I do I get the same error as before when trying to go to /admin).

Why is the path “/userfiles/images” trying to prepend “index.cfm” to it? I know it has to do with the SES URLs.

Thanks,
Aaron

I just noticed that you removed the line in the cbSESGuide as I had done. Cool.

Is there a function or combination of functions that will get me the physical path to the root of my app? That would make it work I think. All I can think of (and tried just for kicks) was GetDirectoryFromPath(GetBaseTemplatePath()) which gets me the physical path to the current template. I just need it to the app root.

Thanks for your help,
Aaron

I found the following function from Pete Freitag which seems to work (see http://www.petefreitag.com/item/630.cfm):

<cffunction name="getApplicationRootPath" returntype="string" hint="Returns the root path of the acting 
Application.cfm file." output="false" access="public">
  <cfargument name="base_path" default="./" hint="Normally you want to leave this as default" required="false">

  <cfset var actual_path = ExpandPath(arguments.base_path)>
  <cfif FileExists(ExpandPath(arguments.base_path & "Application.cfm"))>
    <cfreturn actual_path>
  <cfelseif REFind(".*[/\\].*[/\\].*", actual_path)>

    <cfreturn getApplicationRootPath("../#arguments.base_path#")>
  <cfelse>
    <!--- we have reached the root dir, so throw an error not found --->
    <cfthrow message="Unable to determine Application Root Path" detail="#actual_path#">

  </cfif>
</cffunction>

However, this is just circumventing the problem.

I am kinda of lost still Aaron on where the problem would be. Maybe
somebody else in the group can answer.

What is that path for? Not quite sure where you are getting that from?

Luis

Hi Aaron,

.htaccess you could ignore the /userfiles/images/ path.

Here is the re_write

RewriteCond %{REQUEST_URI} ^userfiles.+$
RewriteRule .* - [L]

Please try this and let us know does this works for you.

Thanks
Sana

Hi Aaron,

The method to use is “controller.getAppRootPath()”

As always, look in the API, the controller is the overseer of your app, so it has several methods that you can use as metadata of your running app. If not, you can also look in the framework settings structure, which should also have the path to your root.

Luis

Sana,

It is the “index.cfm” that needs to be ignored.

Thanks,
Aaron

I cannot use any framework specific code because the template is not a view, handler, controller, layout, etc. The file is located in /admin/includes/fckeditor/editor/filemanager/connectors/cfm/config.cfm

Thanks,
Aaron

Luis,

I have installed FCKEditor in my admin app under /admin/includes/fckeditor

I am using this for a CMS I’m building that uses FCKEditor for WYSIWYG functionality. In the /admin/includes/fckeditor
/editor/filemanager/connectors/cfm/config.cfm file you have to set the path to the location you would like user uploaded files to be saved to. By default it is set to “’/userfiles/” but that keeps throwing an error because " index.cfm" is being prepended to it. In other words, it is trying to create the files in “index.cfm/userfiles/” which it cannot.

Thanks for the help,
Aaron

Hi Aaron,

I have another idea… create a new config.cfm under-webroot then include template /fckeditor/…/…/…/config.cfm

RewriteRule ^/userfile/(.+)$ /config.cfm use this .htaccess rule.

Application.cfc onRequestStart()

<cfif findNoCase(‘index.cfm’, listLast(arguments.targetPage, ‘/’))>
<cfset processColdBoxRequest()>

Thanks
Sana

Hmm.

That wouldn’t work. FCKEditor looks for config.cfm in that directory. Also, it would add more complexity then to just add the function from Pete in the config.cfm and use that. However, all of this is kind of missing the point.

While there are ways of working around the problem, it would be better to fix the problem itself. The problem is that “index.cfm” is being prepended to the path when “/” is used. This has something to do with SES. Unfortunately, I don’t know enough about rewrite rules and such.

Since you know more about .htaccess rules I would request that you download FCKEditor and install it in /admin/includes/fckeditor in an app that is in a virtual directory (Apache host). Perhaps you can determine why " index.cfm" is being prepended to the path.

Do you care to test it and work out what I think may be a bug or incompleteness in the .httaccess rule?

-Aaron

Hi Aaron,

I am happy to do a test, ok this is problem with RewriteRule is determine to add additional stuff or not.

RewriteCond %{REQUEST_URI} ^userfiles.+$
RewriteRule .* - [L]

this means — leave the request as it is and this is last rule , so all next rules will be igonred.

Thanks
Sana

Hey Sana,

Could you tell me how to use these rewrite rules? Should I add them in the .htaccess file located in the /admin directory? If so, do I add them just below RewriteEngine On or below all of the existing rules? Or do I create a new .htaccess file located in /admin/includes/fckeditor/editor/filemanager/connectors/cfm/

Also, that RewriteCond looks specific to my setup as it is checking for a directory called “userfiles”. I am wondering how to make the existing .htaccess file work for all contexts and applications and not just my particular setup of FCKEditor.

What was your experience installing FCKEditor? Did the default setup give you the same errors that I experienced when trying to upload and insert an image into the editor?

Thanks for your help with ColdBox,
Aaron

Hi Aaron,

Sorry been busy… Did not get the chance to test FCK.

put this these rewrite rules in .htaccess then move the file into /admin/ directory

/admin/ is virtual directory …

Options FollowSymLinks
RewriteEngine on

#Escape the following in the URI using pipe delimiter for strings
RewriteCond %{REQUEST_URI} ^userfiles|fckeditor|filemanager.+$
RewriteRule .* - [L]

RewriteRule ^$ index.cfm [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.cfm/%{REQUEST_URI} [QSA,L]

This should works for you.
Tomorrow I will try fckeditor…

Thanks
Sana

Hey,

Just so you know for when you test it yourself, /admin is not a virtual directory. /admin is an app embedded within another app. This is the setup:

Virtual Directory:
C:\wwwroot\website

Coldbox:
C:\wwwroot\website\coldbox

Embedded App:
C:\wwwroot\website\admin

Here is a tree of the app root:

C:\wwwroot\website

admin
coldbox
config
views
handlers
model
includes
index.cfm
Application.cfc
.htaccess

This is what I have in the admin embedded app:
C:\wwwroot\admin

config
model
views
handlers
includes
Application.cfc
index.cfm
.htaccess

I hope that helps to reconstruct my environment and test. FCKeditor is installed in C:\wwwroot\admin\includes\fckeditor

Thanks,
Aaron

Aaron,

Did you ever find a good clean way to integrate FCKEditor with CB?

Dan