Start New Discussion within our Web Development Community

Hi! there is some problem in uploading file. some one help me and please make corrections in code.

//// upload_form.html


<form enctype="multipart/form-data" action="upload_file.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />




$ftp_server = "";
$ftp_username   = "a3877054";
$ftp_password   =  "lms604";

//setup of connection
$conn_id = ftp_connect($ftp_server) or die("could not connect to $ftp_server");

if(@ftp_login($conn_id, $ftp_username, $ftp_password))
      echo "conectd as $ftp_username@$ftp_server\n";

 else {

      echo "could not connect as $ftp_username\n";

$file = $_FILES["file"]["name"];
$remote_file_path = "/public_html/".$file;

ftp_put($conn_id, $remote_file_path, $file, FTP_ASCII);


echo "\n\nconnection closed";


Is there anything in the error logs or are you getting any error messages on screen?

thanks it is solved. but there is still a problem of ftp_get() function. can u give some example?

Check that your host allows file gets. Some don't, which is why I don't use it any more.

This article has been dead for over six months. Start a new discussion instead.