تفضل هذا الكود على السرع عملته لكن ما جربته لأنه قرب موعد دخولي المطار
كود:
if ($_POST["submit"])
{
//->Set up basic connection
$ftp_server = "127.0.0.1";
$ftp_user_name = "rabih";
$ftp_user_pass = "saida@leb961";
$source_file = $file_name;
$destination_file = "/".$source_file;
//-> Lets flight with me :)
$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 "FTP connection has failed!<BR>";
echo "Attempted to connect to $ftp_server for user $ftp_user_name<BR>";
exit;
}
else{echo "Connected to $ftp_server, for user $ftp_user_name<BR>";}
// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
// check upload status
if (!$upload) {
echo "FTP upload has <b>FAILED!</b> source: $source_file dest: $destination_file<BR>";
}
else{echo "Uploaded $source_file to $ftp_server as $destination_file<BR>";
}
// close the FTP stream
ftp_close($conn_id);
//End FTP to Froogle
}
?>
<html>
<head>
<title>Snake_eyes</title>
</head>
<body bgcolor="#333333" text="#CCCCCC" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td align="center" valign="middle">
<form name="form1" enctype="multipart/form-data" method="post" action="<? echo $PHP_SELF; ?>">
<input type="file" name="file_name">
<input type="submit" name="submit" value="Subir">
</form>
</td>
</tr>
</table>
</body>
</html>
تحياتي