2

Hi I have a problem in transferring file from server to server I want to copy file like:

http://mysite1.com/myfile.jpg <-- I want this to copy or upload via ftp to mysite2.com

For example: http://mysite1.com/myfile.jpg upload to http://mysite2.com/fileuploads/

How to do this via PHP FTP transferring? Any hardcoder here can help my problem?

2
  • What's your problem? Have you read through this: no.php.net/manual/en/book.ftp.php ? Commented Nov 29, 2011 at 6:57
  • You say you have a problem in transferring a file from one server to another. You never state what is your problem. You just say give me teh codez. You don't have to be a hardcoder to read the manual. Commented Nov 29, 2011 at 7:16

1 Answer 1

4

Well here's one sample code, but you should read and try on your own before asking:

$connection = ftp_connect($server);

$login = ftp_login($connection, $ftp_user_name, $ftp_user_pass);

if (!$connection || !$login) { die('Connection attempt failed!'); }

$upload = ftp_put($connection, $dest, $source, $mode);

if (!$upload) { echo 'FTP upload failed!'; }

ftp_close($connection); 

Hope it helps you getting started

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.