Jump to content

telliott99

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

telliott99's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thanks for the help, $_FILES is giving the file name. but ftp_put is not working. login works and I am connected to the ftp server. command is $upload = ftp_put($conn_id, $remote_file, $file, FTP_ASCII); uploading a csv file, tried both ASCII and BINARY , tried Passive mode, verified that hosting company allows ftp uploads tried providing path name to public-ftp only error message is my own php error message, doesnt say why. any ideas? code below. $file = $_FILES["file"]["name"]; $directory = $_POST["directory"]; echo "directory = ",$directory,"<br>"; include($directory."phud.php"); echo "Uploaded file = ",$file,"<br>"; echo "Save As file = ",$remote_file,"<br>"; print_r($_FILES['file']); // set up basic connection $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!"; echo "Attempted to connect to $ftp_server for user $ftp_user_name...."; exit; } else { echo "Connected to $ftp_server, for user $ftp_user_name","<br>"; } // turn passive mode on ftp_pasv($conn_id, true); // upload the file $upload = ftp_put($conn_id, $remote_file, $file, FTP_ASCII); // check upload status if (!$upload) { echo "FTP upload has failed!","<br>"; } else { echo "Uploaded $name to $ftp_server ","<br>"; } if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) { echo "Successfully uploaded $file\n";} else {echo "There was a problem while uploading $file\n";} // close the FTP stream ftp_close($conn_id);
  2. Hi, I have used $_POST with type="text" and for type=" hidden". I am now using an html form with input type="file" but I do not get any file name data from the $_POST. html form has <form name="form" enctype="multipart/form-data" action="sp_ftpupload.php" method="POST" > <input type = "file" name = "file" size = "84" accept="text/csv" > <input type = "submit" value = "Upload" style = "vertical-align:middle" > </form> php code has $file = $_POST["file"]; echo "Uploaded file = ",$file,"<br>"; nothing is echo'd. What am I missing?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.