Re: Please HELP me
| From: | Peter James | Date: | Sun, 27 Jul 2003 15:07:56 +0000 |
| Subject: | Re: Please HELP me | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157082@lists.php.net to get a copy of this message | ||
You're not giving us much to work with here. What's the actual problem?
Regardless, I can see a couple of thing wrong here.
1. You're trying to do a multipart/form-data transfer using GET. You need
to use POST.
2. Unless you've got register_globals on, and even if you do, you should be
referencing your uploaded file with $_FILES['util']['tmp_name']
3. You should read the manual here:http://ca2.php.net/features.file-upload
HTH.
Pete.
--
Peter James
petej@phparch.com
php|architect
The Magazine for PHP Professionals
http://www.phparch.com
----- Original Message -----
From: "Rausch Alexandru" <rausch@go.ro>
To: <php-general@lists.php.net>
Sent: Saturday, July 26, 2003 8:50 PM
Subject: [PHP] Please HELP me
I have some problem with uploading a file from my harddisk using a ftp
connection.
Here are the 2 files:
test.php contains the form:
<table>
<form method="get" action="test2.php"
enctype="multipart/form-data">
<tr class=cen>
<td>Titlu gif</td>
<td> :: </td>
<td><input type="file" name="util" class=form1><br><input
type="submit"
value="expediaza"</td>
</tr>
</form>
</table>
and test2.php is the script for upload :
<?
$ftp_server="*****";
$con = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($con, "*****", "*******");
if ((!$con) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server";
$error=1;
} else {
echo "Connected to $ftp_server <br>";
}
$util=strtolower($util);
$destination="tit.gif";
if(ftp_put($con, $destination, $util, FTP_BINARY)){echo "OK ,am pus titlul
<br>";}
else{ echo "eroare<br>";$error=1;}
?>
Thanks in advanced