Question

I have 2 shared linux hostings. One is on Hostgator, another is on BlueHost. My website hosted in Hostgator allows my users to upload files. I want the files my users upload to be uploaded on my BlueHost hosting. Is that possible?

Was it helpful?

Solution

You can do it by this way

$server = 'anysite.com';
$username = 'username';
$password = 'password';
$local_file = 'original.jpg';
$remote_file = 'uploaded.jpg';

$conn = ftp_connect($server);
$login = ftp_login($conn, $username, $password);

ftp_put($conn, $remote_file, $local_file, FTP_ASCII);
ftp_close($conn);

More info Can be found here

http://altafphp.blogspot.in/2011/06/upload-files-to-remote-server.html

OTHER TIPS

Yes it is possible.

You will build your upload form on Hostgator and point the "action" url to the upload handler on BlueHost.

e.g.

HostGator - where the html form is

<form action="http://bluehost-domain.com/upload_file.php" method="post" enctype="multipart/form-data">
...
</form>

Note* Using this method, the user on Hostgator will be redirected to bluehost domain after upload is done.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top