Error in uploading files of local folder to ftp folder
I tried with ftp_put method and it is not working for large files
function UploadMasterFiles() //uploading files from local folder to ftp
{
try
{
$connection = ftp_connect($ip, $port, $timeout);
$login_result = ftp_login($connection, $un, $pw);
$dir = getcwd()."\\files";
// Open a directory, and read its contents
if($connection)
{
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false)
{
if($file !== "." && $file !== "..")
{
if (ftp_put($connection,"FOLD\\SPLITFILES\\".$file,$dir."\\".$file,FTP_ASCII))
{
//echo success;
}
}
else{}
}
closedir($dh);
}
}
}
else
{
//echo "not connected";
}
}
catch(Exception $e)
{
echo "\n Exception Caught", $e->getMessage();
}
}
I have files in my local folder named "files" and want to transfer to my ftp server folder "SPLITFILES". This is the task I want to do.
Now, I am getting error at "if (ftp_put($connection,"FOLD\files\".$file,$dir."\".$file,FTP_ASCII))" this line. warning message is "ftp_put Transfer complete". but files not get transferred. But if files are of less size then this is working. I am unable to pick where the problem is. Please guide me where I am wrong.