Hi Chaps,

I’ve created a web-based FTP site, but having trouble with PHP’s FTP_PUT function.

I’ve tried:

// FTP access parameters
$host = '';
$usr = 'example_user';
$pwd = 'example_password';
// file to move:
$local_file = './';
$ftp_path = '/data/';
// connect to FTP server (port 21)
$conn_id = ftp_connect($host, 21) or die ("Cannot connect to host");
// send access parameters
ftp_login($conn_id, $usr, $pwd) or die("Cannot login");
// turn on passive mode transfers (some servers need this)
// ftp_pasv ($conn_id, true);
// perform file upload
$upload = ftp_put($conn_id, $ftp_path, $local_file, FTP_BINARY);
// check upload status:
print (!$upload) ? 'Cannot upload' : 'Upload complete';
print "\
// close the FTP stream

And also Net_FTP’s FTP_PUT function:

require_once 'Net/FTP.php';

  $test = new Net_FTP('', 21);
  $test->connect('', 21);
  $test->login('username', 'password');
$file_tmp = $_FILES["file"]["tmp_name"];
$file_name = $_FILES["file"]["name"];

$test->put($file_tmp, 'Uploads/'.$file_name, FTP_BINARY);

I’ve tested this with a very small text file and it works OK, but when I try with a zip file of around 9Mb it takes FOREVER, and sometimes doesn’t upload at all, or if it does, it has a size of 0kb.

I need the script to handle big files up to 150Mb in size.

What can I do to speed up the process and is there something I have missed (current config settings > ini_set(‘max_upload_filesize’, 150000000)) ?