Re: Sending a file
| From: | Marcos Almeida Azevedo | Date: | Tue, 17 Mar 2015 07:25:37 +0000 |
| Subject: | Re: Sending a file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324650@lists.php.net to get a copy of this message | ||
On Tue, Mar 17, 2015 at 2:37 PM, Roopesh Palankar <roopeshvilesh@gmail.com>
wrote:
> Hello Guys
>
>
> How to send a file from one system to another system through Lan connection
> using php ftp function.
>
>
>
> Thank you
> Roopesh
>
How about this sample code
<?php
$file = 'somefile.txt';
$remote_file = 'readme.txt';
// 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);
// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}
// close the connection
ftp_close($conn_id);
?>
--
Marcos | I love PHP, Linux, and Java
<http://javadevnotes.com/java-float-to-string-examples>