Jump to content

ftp_fut() not uploading


empiresolutions

Recommended Posts

ftp_put() is not working. this is what i have.

[code=php:0]
$host = "www.site.com";
$ftp_user_name = "username";
$ftp_user_pass = "password";

// declair files
$remote_file = "ITS_BLI_0".$_POST['id'].".csv"; // root level
$file = "/upload/ITS_BLI_0".$_POST['id'].".csv"; // this file dir is root/manager/posts/

// connect to remote server
$hostip = gethostbyname($host);
$conn_id = ftp_connect($hostip);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// IMPORTANT!!! turn passive mode on
ftp_pasv ( $conn_id, true );

if ((!$conn_id) || (!$login_result)) {

echo "FTP connection has failed!";
echo "Attempted to connect to $host for user $ftp_user_name";
die;

} else {

// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {

echo "successfully uploaded $file<br>";

} else {
/** IM GETTING THIS ERROR **/
echo "There was a problem while uploading $file to $host<br>";

}

// close the connection
ftp_close($conn_id);

}

[/code]
[list]I have done the following allready.[/list][list]Used both FTP_ASCII and FTP_BINARY in ftp_put().[/list][list]Passive mode must be on.[/list][list]I have tried ftp_fput().[/list]
Is there a fix? Or maybe a way to view why its erroring on ftp_put().

thanks, [es]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.