Hi All,
I have searched this forum and i haven't been able to find an anwser to this question.
I wanted to keep my media files separately from my main website but i want to be able to upload and link the media files from this domain (where the media files are kept) by using the file manager (and not have to specify the URL) which means i need to specify an absolute path in my file manager script (filemanager/browser/default/connectors/php).
The relative path i have currently works fine but i can't seem to change it to an absolute path in the config.php for my connector (using PHP). Here is the code:
global $Config ;
// Path to user files relative to the document root.
// SECURITY TIP: Uncomment the following line to set a fixed path.
//$Config['UserFilesPath'] = '/UserFiles/';
$Config['UserFilesPath'] = '/uploaded_files/' ;
I am running FCK rc3, how do i change this path to an absolute path? Or is this not possible? Or do i have to modify the connector.php file? If so, how do i change the Serverpath?
An example: My main site runs on http://www.domain1.com and all my media files is on http://www.domain2.com. When i use FCKeditor on http://www.domain1.com and insert a link, i want to be able to browse the media file which is located at http://www.domain2.com. I can easily manually type in the URL to the file i want to link, but the site is also updated by other users with very little technical skills.
Thank you,
S
P.S. This is the best text editor i have used, will be test driving the new release soon.
Wed, 08/24/2005 - 15:13
#1
RE: Upload file path as an absolute path?
(using php)
Cheers,
John
New Zealand
RE: Upload file path as an absolute path?
just found this...from page 3 I think:
file: editor/filemanager/browser/default/frmresourcelist.html
line 67:var sLink = '<a href="#" onclick="OpenFile(\'http://www.domain.com' + fileUrl + '\');return false;">' ;
does thr job!
RE: Upload file path as an absolute path?
(There is an error in the PHP script that alows everyone to write everything, everywhere to your Webserver if not restrikted by webservers-access-rights!)
-Use for example this:------------------------------------------
function GetSecurePath($in_dir)
{
$in_dir=strtr($in_dir,'\\\'":<>!|','/_______');
if (substr($in_dir,-1) !='/') $in_dir = $in_dir . '/';
$out_Dir=array();
$out_Count=0;
$in_DirArr=explode('/', $in_dir);
foreach ($in_DirArr as $FolderName)
{
$FolderName=trim($FolderName);
if (($FolderName!='') && (($FolderName!='.')))
{
if (substr($FolderName,0,2)=='..')
{
$out_Count--;
if ($out_Count<0) $out_Count=0;
}
else
{
$out_Dir[$out_Count]=$FolderName;
$out_Count++;
}
}
}
$out_dir='/';
for ($i=0; $i<$out_Count; $i++)
{
$out_dir .= $out_Dir[$i] .'/';
}
return $out_dir;
}
----------------------------------------------------------
in connector.php to check $GLOBALS["UserFilesPath"] and $sCurrentFolder .
------------
$GLOBALS["UserFilesPath"]=GetSecurePath($GLOBALS["UserFilesPath"]);
$sCurrentFolder =GetSecurePath($sCurrentFolder);
------------
regards Hmilchuser
RE: Upload file path as an absolute path?
Cheers,
S
RE: Upload file path as an absolute path?
@soundsational:
That is also what I wan't to do. And I now think how to fix this since I already am able to browse content on the other domain. You place the entire browser dir on the domain you wan't to browse. In my situation it will look like this:
http://www.main-domain.com/fckeditor/
http://www.managed-domain1.com/browser/
http://www.managed-domain2.com/browser/
http://www.managed-domain3.com/browser/
http://www.managed-domain4.com/browser/
http://www.managed-domain5.com/browser/
Then you change the browse connector link to
FCKConfig.ImageBrowserURL = 'http://www.managed-domain1.com/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php';
From now I was able to browse, upload en create maps on http://www.managed-domain5.com/. But when tryin to select an file, it looked like the javascript was crashing. I think that the adjustment of jsw_nz will fix that by changing:
file: editor/filemanager/browser/default/frmresourcelist.html
line 67:var sLink = '<a href="#" onclick="OpenFile(\'www.managed-domain1.com/UserData/
' + fileUrl + '\');return false;">' ;
I gues that changing this will make the whole thing work. I'm gonna try it when I'm back home and I'll post the results.
RE: Upload file path as an absolute path?
window.top.opener.SetUrl( fileUrl ) ;
saying: Permission Denied. That beceause you are cross domain scripting. Don't know how to solve it.
RE: Upload file path as an absolute path?
I really need two variables, one /the/path/to/save/the/files and the other, the http://path/for/viewing/via/http - i'd be happy to make and commit the changes but before i do, is there any way this is possible already?
RE: Upload file path as an absolute path?
I think I've found it. It seems to work in my installation, your mileage may vary. This if for the .php connector, but should give you a clue where to look for the other.
find the 'basexml.php' in the php connectors folder.
then around line 48 you'll see:
echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder ) ) . '" />' ;
replace that with:
echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . 'http://www.YourSiteHere.com' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder ) ) . '" />' ;
Note there is no trailing slash on the domain.
Hope this helps... I banged my head around for hours trying to get this to work with my newsletter, which required an absolute address in order for the images to show up in the email.
RE: Upload file path as an absolute path?
Please let me know if you've discovered a solutions. I need this for newsletter purposes too.
--Aaron
RE: Upload file path as an absolute path?
Here are the problems I've had and how I've fixed them, after searching this site for an entire day.
Please forgive the uppercase, this was copied from my comments so that when I update, I'll know what to change again. First, the Firefox problem, then, the fix for the PHP problem of viewing and uploading images:
STYLE OPTION WOULD NOT LET THE AREA SHOW IN FIREFOX
CHANGES I HAD TO MAKE TO GET THE IMAGE BROWSER AND UPLOAD TO WORK:
IN /filemanager/browser/default/connectors/php/io.php
IN /filemanager/browser/default/connectors/php/util.php
COMMENT OUT ALL LINES IN function GetRootPath()
/*$sRealPath = realpath( './' ) ;
$sSelfPath = $_SERVER['PHP_SELF'] ;
$sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ;
return substr( $sRealPath, 0, strlen( $sRealPath ) - strlen( $sSelfPath ) ) ;*/
ADD return 'YOURSERVERDOCUMENTROOT';
***to get "YourServerDocumentRoot", look at your phpinfo(); variables
IN /filemanager/browser/default/connectors/php/basexml.php
LINE 47 CHANGE: echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder ) ) . '" />' ;
TO: echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="'.'http://www.YOURDOMAIN.COM' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder ) ) . '" />' ;
FOR UPLOAD TO WORK UPLOAD DIRECTORIES NEED TO BE SET TO 777
RE: File browser help needed
Hi there,
I installed FCK and it is fantastic - except for the life of me I can't get the file browser going. I have tried everything from mcpuk to the advice here:
http://sourceforge.net/forum/message.php?msg_id=3261673
With no luck. My file upload works fine and the XML output on the test page for the php connector seems fine as well (although it seems to display files I can't see with my FTP client)...
I would really appreciate any help....
You can see the FCK page at.....
http://www.cactusclimbing.co.nz/scms/
and connector test is at.....
http://www.cactusclimbing.co.nz/FCKedit ... /test.html
Does anybody out there afctually have the file browser working???