Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: ftp_puts

  1. #1
    New Coder
    Join Date
    Mar 2005
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ftp_puts

    Hey, im writing an update script using ftp but ftp_puts, ftp_fputs ect will return false.

    here is the code
    Code:
    $file_from = "http://220.233.71.51/upgrade-test/upgrades/012-0132/files/index.txt";
    $mode = "FTP_ASCII";
    if ( $file_handle = fopen($file_from, "r") )
    {
    	if ( ftp_fput($ftp, "index.php", $file_handle, $mode) )
    	{
    		echo "<font color='green'>Success</font>";
    	}else{
    		echo "<font color='red'>Failed</font>";
    	}
    }else{
    	echo "<font color='red'>Could not open remote file</font>";
    }
    fclose($file_handle);
    It can open the file but cannot upload it

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    You seem to be mixing things up, take a look at:
    http://uk2.php.net/manual/en/function.ftp-fput.php
    does it help?

  • #3
    New Coder
    Join Date
    Mar 2005
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts
    EDIT: The problem seems to be the $mode
    You have to type FTP_ASCII into the code, using a variable will not work.
    Last edited by Extreme43; 01-03-2006 at 12:24 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •