Published in: PHP
/ FTP access parameters: $host = 'ftp.example.org'; $usr = 'example_user'; $pwd = 'example_password'; // file to upload: $local_file = './example.txt'; $ftp_path = '/data/example.txt'; // connect to FTP server (port 21) // send access parameters // turn on passive mode transfers (some servers need this) // ftp_pasv ($conn_id, true); // perform file upload // check upload status: print "\n"; /* ** Chmod the file (just as example) */ // If you are using PHP4 then you need to use this code: // (because the "ftp_chmod" command is just available in PHP5+) function ftp_chmod($ftp_stream, $mode, $filename){ } } // try to chmod the new file to 666 (writeable) if (ftp_chmod($conn_id, 0666, $ftp_path) !== false) { } else { print "could not chmod $file\n"; } // close the FTP stream
You need to login to post a comment.
