Question : ftp put via php from linux to AS/400

I'm trying to upload a text file to an AS/400 server from a linux server using php commands

I can connect and change the namefmt just fine. I can also upload no problem via shell.

But the problem is is that I am trying to build a crontab  using php that wil automate the process.

so basically I have ( in php)
1:
2:
3:
4:
5:
6:
7:
8:
9:
$ftp_stream = $ftp($server); // ok no problem

ftp_login($ftp_stream,$user,$pass); // still working

ftp_raw($ftp_stream, 'site namefmt 0') ;// getting a 200 series response so still ok

// but here is the problem
ftp_exec($ftp_stream,'put file.txt'); // see error messages below


php is throwing this exception on the `put` command:
1:
2:
Warning: ftp_exec() [<a href='function.ftp-exec'>function.ftp-exec</a>]:  Option on the SITE subcommand not recognized.  in ... *.php on line X


I've tried ftp_raw() to put but the server returns a 500 error
I've also tried bypassing the namfmt update but still the same issue.

I'm not aposed to writing a shell script to do this but I haven't been able to get that to work eiher.

for instance I tried php's exec_shell('bash ftpscript.sh'); where the shell script looks like
1:
2:
3:
4:
5:
6:
7:
8:
ftp -nv <<EOF
open ftp.server.com
user userName passWord
quote site namefmt 0
put file.txt
quit
EOF


with this I am just getting a '250 quit' message

Answer : ftp put via php from linux to AS/400

Try ftp_put, http://us.php.net/manual/en/function.ftp-put.php.  ftp_exec is meant for commands like listing files.
Random Solutions  
 
programming4us programming4us