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)
Change History (12)
Changed 14 years ago by
Changed 14 years ago by
Attachment: | ckfinder.php added |
---|
ckfinder which commented out the php4 connector
comment:1 Changed 14 years ago by
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
Keywords: | CKFinder added |
---|
comment:3 follow-up: 4 Changed 14 years ago by
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 follow-up: 5 Changed 14 years ago by
Ok.. I'm feeling really stupid. When i created the /tmp folder with 0777 it worked.
comment:5 Changed 14 years ago by
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
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\
comment:7 Changed 13 years ago by
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
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
Status: | new → confirmed |
---|
main php connector for php5