Opened 14 years ago

Last modified 12 years ago

#6019 confirmed New Feature

PHP FTP Connector for CKFinder 2.x

Reported by: prdatur Owned by:
Priority: Normal Milestone:
Component: Server : PHP Version:
Keywords: CKFinder Cc: info@…

Description

Hello,

I've written a php connector which will use ftp nstead of file system commands. Right now, only php5 is supported, because i use my own created FTPStandalone class.

Setup is quite easy You need only to add the following config in ckfinder config.php

$configFTP? = array(

"ip" => "127.0.0.1", "port" => "21", "user" => "username", "pass" => "password", "path" => "The/Path/From/FTP_HOME/To/baseurl"

);

port is optional, if not set, port 21 will be used path example webserver document root: /var/www/vhosts/domain.de/httpdocs

base path for uploading: /uploads/files/ckfinder

complete path: /var/www/vhosts/domain.de/httpdocs/uploads/files/ckfinder

ftp homedir (complete path) /var/www/vhosts/domain.de/

so the path configuration should be: $configFTP?path? = "/httpdocs/";

this example is based on parallels plesk

feel free to tell me if you like it or what i could do better.

Attachments (2)

php.zip (83.2 KB) - added by prdatur 14 years ago.
main php connector for php5
ckfinder.php (598 bytes) - added by prdatur 14 years ago.
ckfinder which commented out the php4 connector

Download all attachments as: .zip

Change History (12)

Changed 14 years ago by prdatur

Attachment: php.zip added

main php connector for php5

Changed 14 years ago by prdatur

Attachment: ckfinder.php added

ckfinder which commented out the php4 connector

comment:1 in reply to:  description Changed 14 years ago by prdatur

Replying to prdatur:

didn't know that the chars

[]

are interpreted.

Correct config array:

$config['FTP'] = array(
    "ip" => "127.0.0.1",
    "port" => "21",
    "user" => "username",
    "pass" => "password",
    "path" => "The/Path/From/FTP_HOME/To/baseurl"
); 

comment:2 Changed 14 years ago by Frederico Caldeira Knabben

Keywords: CKFinder added

comment:3 Changed 14 years ago by veldkampj

Thanks for this. I was looking for an FTP uploader for CKFinder. Unfortunately my hosting provider has safe_mode switched on so the thumbnails aren't created.

$fp =	fopen($from, "w+");
fwrite($fp, $content);
fclose($fp);
$return = $this->move_file($from, $destination, $override);
$fp =	fopen($from, "w+");
fwrite($fp, "");
fclose($fp);

This is were it goes wrong. Seems logical to me since fwrite etc. don't work that well when safe_mode is on.

By the way. I noticed this code where thumbnails are created: This is in FileUpload.php

CKFinder_Connector_CommandHandler_Thumbnail::createThumb($sFilePath, $sFilePath, $_imagesConfig->getMaxWidth(), $_imagesConfig->getMaxHeight(), $_imagesConfig->getQuality(), true) ;

And in Thumbnail.php he does this:

if ($sourceFile != $targetFile) {
    if(!$ftp_con->copy($sourceFile, $targetFile))
	return false;
    }
}

Did that ever work? How can you compare 2 strings for difference when the same variable is sent when calling this function?

comment:4 in reply to:  3 ; Changed 14 years ago by veldkampj

Ok.. I'm feeling really stupid. When i created the /tmp folder with 0777 it worked.

comment:5 in reply to:  4 Changed 14 years ago by prdatur

Replying to veldkampj:

Ok.. I'm feeling really stupid. When i created the /tmp folder with 0777 it worked.

Sorry for that. I missed to write that you must create a tmp_file where fwrite has write and read permissions. as default it is

$_SERVER['DOCUMENT_ROOT']."/tmp/tmp"

For that:

 if ($sourceFile != $targetFile) {
			
	if(!$ftp_con->copy($sourceFile, $targetFile))
	{
		return false;
	}
 }

Whats so wrong for that? Dont understand. It checks if the source and target is not equals, if it is different then copy. It would make sense if i copy a file if it already exists. But if someone have problems with that, tell us and feel free to delete the line.

best regards, prdatur

comment:6 Changed 13 years ago by MERT KABADAYI

Cc: info@… added

Hi,

I try for 3 months and I'm having problems. CkFinder integrated, Do you have a working version?

Please help. Very important!

Error Print : Cannot create a file when that file already exists

Warning: ftp_mkdir() [function.ftp-mkdir]: httpdocs/ckfinder/userfiles/files\: Cannot create a file when that file already exists. in C:\Inetpub\vhosts\smyrnart.com\httpdocs\ckfinder\core\connector\

Last edited 13 years ago by MERT KABADAYI (previous) (diff)

comment:7 Changed 13 years ago by Marcel

Can't get this to work :(

CKFinder keeps trying to find the files locally and giving the following error: "Folder not found. Please refresh and try again."

Any help is appreciated!

comment:8 Changed 13 years ago by MERT KABADAYI

Hi,

I approached a lot but I also have problems. If we add msn list to me we can brainstorm. msn address: info[at]mertkabadayi.com

comment:9 Changed 12 years ago by Jakub Ś

Status: newconfirmed

comment:10 Changed 12 years ago by Jakub Ś

It has also been reported on trac for CKFinder.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy