Antz
Member
Registered: 28th Jul 03
Location: Leeds Drives: Myself Insane!
User status: Offline
|
Nooow then...
Just done some coding to make a php page run as an FTP client...
The obvious problem I've run into is... the php page will only take a source file from the server it's based on... not a local machine...
kinda defeats the object of it been FTP software :S
Heres my code... is there anything I can do to it to make it pull files from my machine and poist them via the FTP onto a remote server?
code:
<?php
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "Upload Failed<BR>";
echo "Attempted to Upload Video<BR>";
exit;
} else {
echo "Uploading...<BR>";
}
// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
// check upload status
if (!$upload) {
echo "Video Upload Failed<BR>";
} else {
echo "Uploaded $source_file Complete!<BR>";
}
// close the FTP stream
ftp_close($conn_id);
?>
[Edited on 08-01-2007 by Antz]
|