FTP upload in PHP4
| From: | Vikram Vaswani | Date: | Mon, 30 Oct 2000 19:14:59 +0000 |
| Subject: | FTP upload in PHP4 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22720@lists.php.net to get a copy of this message | ||
Hi!
I'm trying to create a form which selects a file and then uploads it via
FTP to an FTP server. Can someone help me out with the front-end code for
the form, and with the PHP script?
Here's what I've got so far:
<form action=ftput.php4 method=get>
Upload this file:<input type=file name=filen>
<input type=hidden name=server value=<? echo $server; ?>>
<input type=hidden name=username value=<? echo $username; ?>>
<input type=hidden name=password value=<? echo $password; ?>>
<input type=submit>
</form>
And in ftput.php4:
<?
$result = ftp_connect($server);
ftp_login($result, $username, $password);
$a = ftp_put($result, $filen, $filen, FTP_BINARY);
?>
TIA
Vikram