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
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!'; } 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.