This is my code but the problem is the every thing works (The database and ftp connection) the directory stucture is make, but when i what to but the file it doesn't work, it works when whith the code ("Document.txt") in stead of $file with ftp_put, does somebody know a sollution or is it a bug in php4 or ????.
Thanks in advance,
Martijn
include("connect.php4");
// Locatie id ophalen uit query string
$lok_id = getenv("QUERY_STRING");
if (!$lok_id) {
print "Geen lokatie opgegeven...\n";
exit();
}
chdir("/nf/scripts/");
$query = MYSQL_QUERY("SELECT FROM locations WHERE lok_id='$lok_id'");
$query1 = MYSQL_QUERY("SELECT FROM files WHERE lok_id='$lok_id'");
if ($query && $query1){
$aantal=MYSQL_NUMROWS($query);
$aantal1=MYSQL_NUMROWS($query1);
$name=MYSQL_RESULT($query,'0','name');
$user=MYSQL_RESULT($query,'0','user');
$ip=MYSQL_RESULT($query,'0','ip');
$pass=MYSQL_RESULT($query,'0','pass');
$ftp = ftp_connect($ip);
if (!$ftp){
print "Geen ftp connectie...\n";
exit();
}
$login = ftp_login ($ftp, $user,$pass);
if (!$login){
print "Geen login...\n";
exit();
}
for ($i=0;$aantal1>$i;$i++){
$upper=0;
$path=MYSQL_RESULT($query1,$i,'path');
$type=MYSQL_RESULT($query1,$i,'type');
$ext =MYSQL_RESULT($query1,$i,'extension');
if ($ext=".txt" || $ext==".scala"){
$mode = "FTP_ASCII";
} else {
$mode = "FTP_BINARY";
}
$dir = explode("/",$path);
$nummer = count($dir);
if ($dir[0]=="."){
} else {
for($j=0;$nummer>($j+1);$j++){
$changedir = ftp_chdir ($ftp, $dir[$j]);
if (!$changedir){
$mkdir = ftp_mkdir ($ftp, $dir[$j]);
if ($mkdir){
$j--;
}
} else {
chdir($dir[$j]);
$upper++;
}
}
}
$file = $dir[($nummer-1)];
if ($type=='0'){
$delete = ftp_delete ($ftp, $file);
if (!$delete){
print "file: $file niet verwijderd.<br>\n";
}
} elseif ($type=='1'){
$upload = ftp_put($ftp, $file, "$file", FTP_ASCII);
if (!$upload){
print "file: $file niet upgeload.<br><br>\n";
}
}
for ($j=0;$upper>$j;$j++){
ftp_cdup($ftp);
chdir("../");
}
}
}
ftp_quit($ftp);
mysql_close();
?>