I have added this functionality myself, and included the code in hopes that it be implemented in future releases so everyone can use it.
The following parameters should be set:
<PARAM NAME="folderdepth" VALUE="-1">
<PARAM NAME="postparameters" VALUE="extrarelative"
<PARAM NAME="param9" VALUE="notifyrelativefilename">');
<PARAM NAME="value9" VALUE="true">
<PARAM NAME="post" VALUE="
http://www.yoursite.com/postftp.php">
This is what is in postftp.php:
Code: Select all
<?php
//chmod of subfolders, since JFileUpload does not support this
//jason blount 10/10
$debug = false; //change this?
// FTP access parameters
$host = 'FTP.SITE.COM';
$usr = 'USER';
$pwd = 'PASS';
if(isset($_POST['filename1'])){
if ($debug) $log = fopen("ftpdebug.txt","a");
if ($debug) fwrite($log,"\n-----".date("D M j G:i:s T Y")."-----\n");
// connect to FTP server
$conn_id = ftp_connect($host);
if (ftp_login($conn_id, $usr, $pwd)){
if ($debug) fwrite($log, "logged onto $host\n");
}else{
if ($debug) fwrite($log, "failed to log onto $host!\n");
}
//need to chmod each folder to 0777
//$acc= $_POST['account']; //uncomment these line
//ftp_chdir($conn_id, $acc); //if you use account param
//if ($debug) fwrite($log, "account: $acc\n");
foreach($_POST as $key => $file){
if (substr($key, 0, 8) == "filename"){
//each uploaded file
if ($debug) fwrite($log, "$key => $file\n");
$subs = str_replace("\\","/",$file);
$subs = substr($subs, 0, strrpos($subs,"/"))."/";
if ($debug) fwrite($log, "subs: $subs\n");
while(strpos($subs, "/") !== false){
//while there are still directories in here
$subs = substr($subs,0,strlen($subs)-1);
if ($debug) fwrite($log, "chmod $subs to 0777\n");
ftp_chmod($conn_id, 0777, $subs);
$subs = substr($subs, 0, strrpos($subs,"/")+1);
if (strlen($subs) <= 2) $subs = "";
}
}
}
ftp_close($conn_id);
if ($debug) fclose($log);
}
?>
Edit the text in caps to suit your needs. Hope this helps
