Upload from URL to FTP server

2

1

Ok, I have a tar.gz file somewhere in a web server. The link looks like http://abcd.com/abcd.tar.gz .. And I have an FTP server running somewhere. Now, to upload the file to the FTP server, Typically I need to download it from the web server and then upload it again to the FTP server.

But I'm wondering if there is anyway, I can directly transfer the file to the FTP server over the web. Not by downloading and uploading again. Any help?

Bibhas

Posted 2010-06-02T09:37:44.620

Reputation: 2 490

Answers

4

There is no cross specification of HTTP and FTP which would allow the two to interact. Someone, somewhere, would have to download, and then upload it.

If you have shell access to the web server, the easiest way would be to upload it directly from the webserver to the ftp server with the ftp command (Assuming it's a *nix server.)

If you have shell access to the ftp server, then you could also use the wget command to download the file directly to the ftp server, again assuming it's a *nix server.

Darth Android

Posted 2010-06-02T09:37:44.620

Reputation: 35 133

looking back at this, I feel really stupid. – Bibhas – 2013-08-23T15:20:16.327

1

You could take a look at the File eXchange Protocol if you happen to have FTP access to the website (HTTP) server, and both your FTP server and the the website FTP sever have FXP enabled.

GummiV

Posted 2010-06-02T09:37:44.620

Reputation: 621

This, if you have ftp access to both :) – sinni800 – 2010-10-05T08:56:19.827

1

You can take a look at AutoFileMove , it allow users to send files direclty to FTP, dropbox and amazon s3 from URL without downloading files to local devices first.
http://youtu.be/sSgqfeMl9is

Amr Elgarhy

Posted 2010-06-02T09:37:44.620

Reputation: 747

0

If your server supports PHP, then you can upload a PHP file (1 or 2KB) - open it through http, copy paste the URL in the provided box, then submit. Your server will download it for you.

<html>
<form method="post">
<input name="url" size="50" />
<input name="submit" type="submit" />
</form>
 <?php
    // maximum execution time in seconds
   set_time_limit (24 * 60 * 60);

if (!isset($_POST['submit'])) die();

// folder to save downloaded files to. must end with slash
// $destination_folder = 'download/';

$url = $_POST['url'];
$newfname = basename($url);

$file = fopen ($url, "rb");
if ($file) {
  $newf = fopen ($newfname, "wb");

  if ($newf)
  while(!feof($file)) {
    fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
  }
}

if ($file) {
  fclose($file);
}

if ($newf) {
  fclose($newf);
}
?>
</html>

Copy the above script -> Open text editor -> paste -> save something**.php** Upload it and view with your browser in http .

The above script downloads the file and saves in the same directory where it resides, if you want to save in some other directory, then you need to change some piece.

Ramamoorthy

Posted 2010-06-02T09:37:44.620

Reputation: 9

0

Try this:
Upload a php file with this code e.g. copy.php

    <?php
    copy("http://abcd.com/abcd.tar.gz","abcd.tar.gz");
    echo "File Uploaded";
    ?>

Now open http://www.your-site.com/copy.php in your browser. Wait for the copy.php to load completely. Enjoy!

Faizan Khalid

Posted 2010-06-02T09:37:44.620

Reputation: 1