Jump to content

Best Method to transfer files?


AtomicRax

Recommended Posts

I'm not asking for specific coding help, but what I am looking for is an answer from someone who might have dealt with this in the past and can help shed some light on the subject.

 

I'm working on a website that allows the user to upload several images at a time. I have serverA that hosts the website and database and serverB that hosts the image uploads.

 

I'm looking for the best (preferably the fastest) method to transfer image files from serverA to serverB.

 

I know I can transfer the files through FTP in PHP and I can also do it via HTTP by making a small script on serverB that would accept _POST transfers of each file.. Are there other methods?

 

Remember, there are 2-3 images sent each time.. so just because a method might be "preferred," I don't want to make the user wait longer than they have to.

 

Thanks for your time.

Link to comment
https://forums.phpfreaks.com/topic/226501-best-method-to-transfer-files/
Share on other sites

That's what I was thinking, since it's actually meant for file transfers, but I just wanted to make sure. Thanks!

 

And for others who are curious, here's two snippets I found online at http://davidwalsh.name/send-files-ftp-php

 

$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); 

 

$upload = copy($source,
'ftp://user:password@host/path/file');
if (!$upload) { echo 'FTP upload
failed!'; } 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.