1

I need to use a form to retrieve text from an online user and create a *.txt file with the submission on my server. I have ftp working now but I could use something else if I have to.

Here's what I've written for the form:

<form name="input" action="upload.php" method="post" 
enctype="multipart/form-data">

<textarea input type="text" name="form" cols="100" rows="20" 
name="body"></textarea><p>

<input type="submit" name="form" value="Submit"></center>
</form>

Here's my upload.php:

<?php

$filep=$_POST['form']['form']; 
$ftp_server=['http://ftp.***.***'];
$ftp_user_name=['***'];
$ftp_user_pass=['***'];
$paths=['***'];
$name=['test.txt'];

$conn_id=ftp_connect($ftp_server);

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

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".".....";
}

$upload = ftp_put($conn_id, $paths.'/public_ftp'.$name, $filep, FTP_BINARY);

if (!$upload) {
   echo "FTP upload has failed!";
} else {
   echo "Uploaded $name to $ftp_server ";
}

?>

I starred-out the logon info because it's not necessary.

This script goes blank. Not even an error message.

I'm not even sure if I'm on the right path. I've found bits of code that might work but nothing that does everything I need. Help!

tqastro
  • 33
  • 1
  • 4

0 Answers0