<?php
$ftp_server = "ftp.server.url";
$ftp_user = "user";
$ftp_password = "password";
$file_to_upload = "localfile.txt";
$remote_location = "/location/file.txt";
// set up connection or exit with message
$flink = ftp_connect($ftp_server) or exit("Can't connect to ftp server: $ftp_server");
// login or at least try
if(ftp_login($flink, $ftp_user, $ftp_password)) {
// if login successful use ftp_put to upload the file
// if you upload binary files use mode FTP_BINARY
if(ftp_put($flink, $remote_location, $file_to_upload, FTP_ASCII)) {
echo "Success! File is uploaded!";
} else {
echo "Can't upload file";
}
} else {
echo "Can't login with this user & password";
}
// close the connection
ftp_close($flink);
?>
You can get more information at http://www.php.net/manual/en/ref.ftp.php
Java, JSP, JSF, Struts, Hibernate and Ajax from an everyday life. Nothing serious just some thoughts.
Sep 9, 2011
Fast PHP example - FTP file upload
Here is one fast and simple example on how to do FTP file uploads with PHP.
Subscribe to:
Post Comments (Atom)
Popular Posts
-
I’ll continue my article about JQuery Effects - with this one. It would be short information on how to make custom JQuery slideshow animati...
-
This tutorial tries to provide fast and easy instructions on getting started with Hibernate. You can download Hibernate from http://www.hibe...
-
I receive this nasty error yesterday and it took me some time to figure out the problem. This line passes without any problems $client = n...
-
JMesa is a very useful open source project.It is a dynamic HTML table that allows you to edit, filter, sort, paginate and export your data....
-
This would be simple and easy tutorial on how to use Apache Struts in Java web projects. What do you need for this tutorial? Java Tomcat...
-
Here is one fast and simple example on how to do FTP file uploads with PHP. < ? php $ ftp_server = "ftp.server.url" ; $ ...
-
This question is somewhat painful for me. Maybe I am too stupid. Anyway, if you want to make tar archive without using exec, for example on ...
-
JQuery is a lightweight JavaScript framework that got a lot of attention lately so I decided to write few rows about it. This post-tutorial...
-
You can use JQuery Effects in many different ways. I'll write few examples just to show how cool and fun is to work with this API. Usi...
-
Using SOAP with PHP can be very easy if you do everything right. First your PHP must be configured with --enable-soap. With Windows and WAMP...
No comments:
Post a Comment