0

Hello, I tried many different combinations to get this to work, but with no success. As always, I try my best and spend a lot of time in trying to get something to work before I ask for help on something.

My question is, how can I pass parameter from an online form, via FTP and with PHP 4?

Here is what I have so far, but am getting an error:

$path1= "../uploads/".$HTTP_POST_FILES['ufile']['name'][0];

// START FTP
// set up basic connection

$ftp_server = "mysite.com";

$conn_id = ftp_connect($ftp_server) or die("Could not connect");

// login with username and password
$ftp_user_name = "myusername";
$ftp_user_pass = "mypassword";


// upload $file - Either FTP_ASCII or FTP_BINARY
if (ftp_fput($conn_id, $target, $HTTP_POST_FILES["ufile"]["name"], FTP_BINARY))
{
    echo "Successfully uploaded $target\n";
}

else
{
    echo "There was a problem while uploading $source\n";
}

// close the connection and the file handler
ftp_close($conn_id);


// END FTP
2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by fredfletcher
0

No, I want to know if it's possible to upload from the form using FTP instead of HTTP, is it possible?

0

There are examples to be found that use Javascript to open FTP in the browser, but that is not very secure.

As soon as you send your form to a PHP script, then the file is already sent to the server for you, you just need to move it to a permanent location.

0

Thanks to all, I thought I was able to use FTP instead of HTTP via a form to upload files. My mistake.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.