Re: need a transfer script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It really depends on your operating system and ftp program
once the file is transfered to the system (using php) extend the code:
on unix/linux systems the easiest way is to create (using php) a '.netrc' file
in the users home directory with following contents
machine ftp.byethost9.com
login <your login on the above system>
password <your password on the above system>
macdef init
lcd <local directory of the picture>
cd <remote directory of where the picture is to be copied to>
prompt
binary
put <picture file name>
bye


make sure to complete the file with 2 blank lines
execute following php statements:
$za= system(chmod 400 ~/.netrc);
$result='';
$zb= exec ('ftp ftp.byethost9.com',&$result);
# the array $result can be scanned for any problems that might exist in the transfer
note: if the .netrc file is created on pc make sure that the lines end in <carriage return>
and have no <line feed> added to them

for windows/dos systems:
create a file with just the things you would enter on the ftp prompt when executed manualy
exp: file pcftpupload.txt
<your login on the above system>
<your password on the above system>
lcd <local directory of the picture>

cd <remote directory of where the picture is to be copied to>

prompt

binary

put <picture file name>

bye

no blank line is required at the end
the php instructions will be:
$result='';

$zb= exec ('ftp -s:pcftpupload.txt ftp.byethost9.com',&$result);

# the array $result can be scanned for any problems that might exist in the transfer


regards,
 Edward Willekens



--- On Tue, 1/12/10, hno <hno2005@xxxxxxxxx> wrote:

From: hno <hno2005@xxxxxxxxx>
Subject:  need a transfer script
To: php-objects@xxxxxxxxxxxxxxx
Date: Tuesday, January 12, 2010, 11:28 AM







 



  


    
      
      
       



HI



I want each time a picture uploaded in my site one copy of that transfer to

another host. how can do that with ftp?



Thanks



image002



HNO



[Non-text portions of this message have been removed]





    
     

    
    


 



  






      

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux