Transfer Queue: Files are uploaded incorrectly

I've been using SmartFTP for years and this is the first, though annoying, bug I found. So thanks for the great work

Now let's get down to the nitty-gritty:
If upload files using the transfer queue (tried both ASCII and binary mode) the files are not uploaded correctly to my server. I'll add a file as example for "not uploaded correctly". OS: WinXP

Original file on server:

<?php

/**

 * Basic constants/variables required for flyspray operation

 *

 * @notes be a real paranoid here.

 * @version $Id: constants.inc.php 1230 2007-05-22 21:14:25Z floele $

 * @notes : do not modify this file, use constants.$_SERVER['SERVER_NAME'].php if you need

 * to alter some behaviuor.

 */



if (!defined('BASEDIR')) {

	define('BASEDIR', dirname(dirname(__FILE__)));

}



// Change this line if you move flyspray.conf.php elsewhere

$conf = @parse_ini_file(Flyspray::get_config_path(), true);



// $baseurl

if (isset($conf['general']['force_baseurl']) && $conf['general']['force_baseurl'] != '') {

	$baseurl = $conf['general']['force_baseurl'];

} else {

	if (!isset($webdir)) {

		$webdir = dirname($_SERVER['SCRIPT_NAME']);

		if (substr($webdir, -9) == 'index.php') {

			$webdir = dirname($webdir);

		}

	}



	$baseurl = rtrim(Flyspray::absoluteURI($webdir),'/\\') . '/';

}



if(isset($conf['general']['syntax_plugin']) && preg_match('/^[a-z0-9_]+$/iD', $conf['general']['syntax_plugin'])) {



$path_to_plugin = sprintf('%s/plugins/%s/%s_constants.inc.php',

						  BASEDIR, $conf['general']['syntax_plugin'], $conf['general']['syntax_plugin']);



	if (is_readable($path_to_plugin)) {

		include($path_to_plugin);

	}

}



define('NOTIFY_TASK_OPENED',	  1);

define('NOTIFY_TASK_CHANGED',	 2);

define('NOTIFY_TASK_CLOSED',	  3);

define('NOTIFY_TASK_REOPENED',	4);

define('NOTIFY_DEP_ADDED',		5);

define('NOTIFY_DEP_REMOVED',	  6);

define('NOTIFY_COMMENT_ADDED',	7);

define('NOTIFY_REL_ADDED',		9);

define('NOTIFY_OWNERSHIP',	   10);

define('NOTIFY_CONFIRMATION',	11);

define('NOTIFY_PM_REQUEST',	  12);

define('NOTIFY_PM_DENY_REQUEST', 13);

define('NOTIFY_NEW_ASSIGNEE',	14);

define('NOTIFY_REV_DEP',		 15);

define('NOTIFY_REV_DEP_REMOVED', 16);

define('NOTIFY_ADDED_ASSIGNEES', 17);

define('NOTIFY_ANON_TASK',	   18);

define('NOTIFY_PW_CHANGE',	   19);

define('NOTIFY_NEW_USER',		20);

define('NOTIFY_REMINDER',		21);

define('NOTIFY_DIGEST',		  21);



define('NOTIFY_EMAIL',			1);

define('NOTIFY_JABBER',		   2);

define('NOTIFY_BOTH',			 3);

define('ADDRESS_TASK',			1);

define('ADDRESS_USER',			2);

define('ADDRESS_EMAIL',		   3);

define('ADDRESS_DONE',			4);



define('FIELD_LIST',			  1);

define('FIELD_DATE',			  2);

define('FIELD_TEXT',			  3);

define('FIELD_USER',			  4);



define('LIST_BASIC',			  1);

define('LIST_VERSION',			2);

define('LIST_CATEGORY',		   3);



// Do modes

define('MENU_GLOBAL',			 1);

define('MENU_PROJECT',			2);



define('ERROR_INTERNAL',		  7);

define('ERROR_INPUT',			 6);

define('ERROR_DB',				5);

define('ERROR_PERMS',			 4);

define('ERROR_RECOVER',		   3);

define('SUBMIT_OK',			   2);

define('NO_SUBMIT',			   1);



// Function parameters

define('REINDEX',			  true);

define('GET_CONTENTS',		 true);

define('LOCK_FIELD',		   true);

define('USE_DEFAULT',		  true);

define('ADODB_AUTOQUOTE',	  true);

define('PLAINTEXT',			true);



// Others

define('MIN_PW_LENGTH', 5);

define('LOGIN_ATTEMPTS', 5);

define('FS_CACHE_DIR', Flyspray::get_tmp_dir() . DIRECTORY_SEPARATOR . md5($_SERVER['SERVER_NAME']  . (int)$_SERVER['SERVER_PORT']));



is_dir(FS_CACHE_DIR) || mkdir(FS_CACHE_DIR, 0700);

//local installation constants, this file must not exist in the svn repository.



if(is_readable(BASEDIR . '/includes/constants.' . $_SERVER['SERVER_NAME'] . '.php')) {

	include(BASEDIR . '/includes/constants.' . $_SERVER['SERVER_NAME'] . '.php');

}

// developers or advanced users only

//define('DEBUG_SQL',		  true);

//define('FS_NO_EMAIL',   true);

?>

New file in the queue:

<?php

/**

 * Basic constants/variables required for flyspray operation

 *

 * @notes be a real paranoid here.

 * @version $Id: constants.inc.php 1253 2007-05-29 09:03:14Z judas_iscariote $

 * @notes : do not modify this file, use constants.$_SERVER['SERVER_NAME'].php if you need

 * to alter some behaviuor.

 */



if (!defined('BASEDIR')) {

	define('BASEDIR', dirname(dirname(__FILE__)));

}



// Change this line if you move flyspray.conf.php elsewhere

$conf = @parse_ini_file(Flyspray::get_config_path(), true);



// $baseurl

if (isset($conf['general']['force_baseurl']) && $conf['general']['force_baseurl'] != '') {

	$baseurl = $conf['general']['force_baseurl'];

} else {

	if (!isset($webdir)) {

		$webdir = dirname($_SERVER['SCRIPT_NAME']);

		if (substr($webdir, -9) == 'index.php') {

			$webdir = dirname($webdir);

		}

	}



	$baseurl = rtrim(Flyspray::absoluteURI($webdir),'/\\') . '/';

}



if(isset($conf['general']['syntax_plugin']) && preg_match('/^[a-z0-9_]+$/iD', $conf['general']['syntax_plugin'])) {



$path_to_plugin = sprintf('%s/plugins/%s/%s_constants.inc.php',

						  BASEDIR, $conf['general']['syntax_plugin'], $conf['general']['syntax_plugin']);



	if (is_readable($path_to_plugin)) {

		include($path_to_plugin);

	}

}



define('NOTIFY_TASK_OPENED',	  1);

define('NOTIFY_TASK_CHANGED',	 2);

define('NOTIFY_TASK_CLOSED',	  3);

define('NOTIFY_TASK_REOPENED',	4);

define('NOTIFY_DEP_ADDED',		5);

define('NOTIFY_DEP_REMOVED',	  6);

define('NOTIFY_COMMENT_ADDED',	7);

define('NOTIFY_REL_ADDED',		9);

define('NOTIFY_OWNERSHIP',	   10);

define('NOTIFY_CONFIRMATION',	11);

define('NOTIFY_PM_REQUEST',	  12);

define('NOTIFY_PM_DENY_REQUEST', 13);

define('NOTIFY_NEW_ASSIGNEE',	14);

define('NOTIFY_REV_DEP',		 15);

define('NOTIFY_REV_DEP_REMOVED', 16);

define('NOTIFY_ADDED_ASSIGNEES', 17);

define('NOTIFY_ANON_TASK',	   18);

define('NOTIFY_PW_CHANGE',	   19);

define('NOTIFY_NEW_USER',		20);

define('NOTIFY_REMINDER',		21);

define('NOTIFY_DIGEST',		  21);



define('NOTIFY_EMAIL',			1);

define('NOTIFY_JABBER',		   2);

define('NOTIFY_BOTH',			 3);

define('ADDRESS_TASK',			1);

define('ADDRESS_USER',			2);

define('ADDRESS_EMAIL',		   3);

define('ADDRESS_DONE',			4);



define('FIELD_LIST',			  1);

define('FIELD_DATE',			  2);

define('FIELD_TEXT',			  3);

define('FIELD_USER',			  4);



define('LIST_BASIC',			  1);

define('LIST_VERSION',			2);

define('LIST_CATEGORY',		   3);



// Do modes

define('MENU_GLOBAL',			 1);

define('MENU_PROJECT',			2);



define('ERROR_INTERNAL',		  7);

define('ERROR_INPUT',			 6);

define('ERROR_DB',				5);

define('ERROR_PERMS',			 4);

define('ERROR_RECOVER',		   3);

define('SUBMIT_OK',			   2);

define('NO_SUBMIT',			   1);



// Function parameters

define('REINDEX',			  true);

define('GET_CONTENTS',		 true);

define('LOCK_FIELD',		   true);

define('USE_DEFAULT',		  true);

define('ADODB_AUTOQUOTE',	  true);

define('PLAINTEXT',			true);



// Others

define('MIN_PW_LENGTH', 5);

define('LOGIN_ATTEMPTS', 5);

define('FS_CACHE_DIR', Flyspray::get_tmp_dir() . DIRECTORY_SEPARATOR . md5($_SERVER['SERVER_NAME']  . BASEDIR));



is_dir(FS_CACHE_DIR) || mkdir(FS_CACHE_DIR, 0700);

//local installation constants, this file must not exist in the svn repository.



if(is_readable(BASEDIR . '/includes/constants.' . $_SERVER['SERVER_NAME'] . '.php')) {

	include(BASEDIR . '/includes/constants.' . $_SERVER['SERVER_NAME'] . '.php');

}



defined('FS_ATTACHMENTS_DIR') || define('FS_ATTACHMENTS_DIR', BASEDIR . DIRECTORY_SEPARATOR . 'attachments');



// developers or advanced users only

//define('DEBUG_SQL',		  true);

//define('FS_MAIL_DEBUG', true);

//define('FS_NO_EMAIL',   true);

?>

After uploading the file (including others), this is the resulting file on the server (which is unusable btw, check the end of the file):

<?php

/**

 * Basic constants/variables required for flyspray operation

 *

 * @notes be a real paranoid here.

 * @version $Id: constants.inc.php 1230 2007-05-22 21:14:25Z floele $

 * @notes : do not modify this file, use constants.$_SERVER['SERVER_NAME'].php if you need

 * to alter some behaviuor.

 */



if (!defined('BASEDIR')) {

	define('BASEDIR', dirname(dirname(__FILE__)));

}



// Change this line if you move flyspray.conf.php elsewhere

$conf = @parse_ini_file(Flyspray::get_config_path(), true);



// $baseurl

if (isset($conf['general']['force_baseurl']) && $conf['general']['force_baseurl'] != '') {

	$baseurl = $conf['general']['force_baseurl'];

} else {

	if (!isset($webdir)) {

		$webdir = dirname($_SERVER['SCRIPT_NAME']);

		if (substr($webdir, -9) == 'index.php') {

			$webdir = dirname($webdir);

		}

	}



	$baseurl = rtrim(Flyspray::absoluteURI($webdir),'/\\') . '/';

}



if(isset($conf['general']['syntax_plugin']) && preg_match('/^[a-z0-9_]+$/iD', $conf['general']['syntax_plugin'])) {



$path_to_plugin = sprintf('%s/plugins/%s/%s_constants.inc.php',

						  BASEDIR, $conf['general']['syntax_plugin'], $conf['general']['syntax_plugin']);



	if (is_readable($path_to_plugin)) {

		include($path_to_plugin);

	}

}



define('NOTIFY_TASK_OPENED',	  1);

define('NOTIFY_TASK_CHANGED',	 2);

define('NOTIFY_TASK_CLOSED',	  3);

define('NOTIFY_TASK_REOPENED',	4);

define('NOTIFY_DEP_ADDED',		5);

define('NOTIFY_DEP_REMOVED',	  6);

define('NOTIFY_COMMENT_ADDED',	7);

define('NOTIFY_REL_ADDED',		9);

define('NOTIFY_OWNERSHIP',	   10);

define('NOTIFY_CONFIRMATION',	11);

define('NOTIFY_PM_REQUEST',	  12);

define('NOTIFY_PM_DENY_REQUEST', 13);

define('NOTIFY_NEW_ASSIGNEE',	14);

define('NOTIFY_REV_DEP',		 15);

define('NOTIFY_REV_DEP_REMOVED', 16);

define('NOTIFY_ADDED_ASSIGNEES', 17);

define('NOTIFY_ANON_TASK',	   18);

define('NOTIFY_PW_CHANGE',	   19);

define('NOTIFY_NEW_USER',		20);

define('NOTIFY_REMINDER',		21);

define('NOTIFY_DIGEST',		  21);



define('NOTIFY_EMAIL',			1);

define('NOTIFY_JABBER',		   2);

define('NOTIFY_BOTH',			 3);

define('ADDRESS_TASK',			1);

define('ADDRESS_USER',			2);

define('ADDRESS_EMAIL',		   3);

define('ADDRESS_DONE',			4);



define('FIELD_LIST',			  1);

define('FIELD_DATE',			  2);

define('FIELD_TEXT',			  3);

define('FIELD_USER',			  4);



define('LIST_BASIC',			  1);

define('LIST_VERSION',			2);

define('LIST_CATEGORY',		   3);



// Do modes

define('MENU_GLOBAL',			 1);

define('MENU_PROJECT',			2);



define('ERROR_INTERNAL',		  7);

define('ERROR_INPUT',			 6);

define('ERROR_DB',				5);

define('ERROR_PERMS',			 4);

define('ERROR_RECOVER',		   3);

define('SUBMIT_OK',			   2);

define('NO_SUBMIT',			   1);



// Function parameters

define('REINDEX',			  true);

define('GET_CONTENTS',		 true);

define('LOCK_FIELD',		   true);

define('USE_DEFAULT',		  true);

define('ADODB_AUTOQUOTE',	  true);

define('PLAINTEXT',			true);



// Others

define('MIN_PW_LENGTH', 5);

define('LOGIN_ATTEMPTS', 5);

define('FS_CACHE_DIR', Flyspray::get_tmp_dir() . DIRECTORY_SEPARATOR . md5($_SERVER['SERVER_NAME']  . (int)$_SERVER['SERVER_PORT']));



is_dir(FS_CACHE_DIR) || mkdir(FS_CACHE_DIR, 0700);

//local installation constants, this file must not exist in the svn repository.



if(is_readable(BASEDIR . '/includes/constants.' . $_SERVER['SERVER_NAME'] . '.php')) {

	include(BASEDIR . '/includes/constants.' . $_SERVER['SERVER_NAME'] . '.php');

}

// developers or advanced users only

//define('DEBUG_SQL',		  true);

//define('FS_NO_EMAIL',   true);

?>

s or advanced users only

//define('DEBUG_SQL',		  true);

//define('FS_MAIL_DEBUG', true);

//define('FS_NO_EMAIL',   true);

?>

Note that *without* using the queue, it works fine.

Since no one seems to care, here is a log file with more information (a different file, but symptoms are the same):

[20070611 17:22:20] Log opened

[20070611 17:22:20] CWD /devel/includes

[20070611 17:22:20] 250 CWD command successful

[20070611 17:22:20] PWD

[20070611 17:22:20] 257 "/devel/includes" is current directory.

[20070611 17:22:20] Remote file exist check: "class.notify.php".

[20070611 17:22:20] SIZE class.notify.php

[20070611 17:22:20] 213 35401

[20070611 17:22:20] MDTM class.notify.php

[20070611 17:22:20] 213 20070607223940

[20070611 17:22:20] Source File: Size=35950, SizeUnit=Byte, Time=2007-06-11T05:01:35, TimeFormat=Exact

[20070611 17:22:20] Destination File: Size=35401, SizeUnit=Byte, Time=2007-06-07T22:39:40, TimeFormat=Exact

[20070611 17:22:20] Rule "IF Destination Time=Recent AND Size=Smaller AND Transfer=No Matter THEN Resume" matched. Action="Resume".

[20070611 17:22:20] PASV

[20070611 17:22:20] 227 Entering Passive Mode (85,13,132,85,195,99).

[20070611 17:22:20] Opening data connection to 85.13.132.85 Port: 50019

[20070611 17:22:20] REST 35401

[20070611 17:22:20] 350 Restarting at 35401. Send STORE or RETRIEVE to initiate transfer

[20070611 17:22:20] STOR class.notify.php

[20070611 17:22:20] 150 Opening BINARY mode data connection for class.notify.php

[20070611 17:22:20] 549 bytes transferred. (6,87 KB/s) (78 ms)

[20070611 17:22:20] 226-Transfer complete.

[20070611 17:22:20] 226 File passed ClamAV virus scanner.

[20070611 17:22:20] MDTM 20070611050135 class.notify.php

[20070611 17:22:20] 550 20070611050135 class.notify.php: No such file or directory

[20070611 17:22:20] SIZE class.notify.php

[20070611 17:22:20] 213 35950

[20070611 17:22:20] Log closed

In this particular case the last 25 lines of the file were added to the end, so that it looks like this:

...

			case NOTIFY_NEW_USER:

				$body = L('messagefrom'). $data[0] . "\r\n\r\n";

				$body .= L('newuserregistered')." \r\n\r\n";

				$body .= L('username') . ': ' . $data[1] . "\r\n";

				$body .= L('realname') . ': ' . $data[2] . "\r\n";

				if ($data[6]) {

					$body .= L('password') . ': ' . $data[5] . "\r\n";

				}

				$body .= L('emailaddress') . ': ' . $data[3] . "\r\n";

				if($data[4]) {

					$body .= L('jabberid') . ':' . $data[4] . "\r\n\r\n";

				}

				break;



			case NOTIFY_REMINDER:

			case NOTIFY_DIGEST:

				$body = $data['message'] . "\r\n\r\n";

				break;

		}



		$body .= L('disclaimer');

		return array($subject, $body);

	}

}



?>

			  $body .= L('password') . ': ' . $data[5] . "\n";

				}

				$body .= L('emailaddress') . ': ' . $data[3] . "\n";

				if($data[4]) {

					$body .= L('jabberid') . ':' . $data[4] . "\n\n";

				}

				break;



			case NOTIFY_REMINDER:

			case NOTIFY_DIGEST:

				$body = $data['message'] . "\n\n";

				break;

		}



		$body .= L('disclaimer');

		return array($subject, $body);

	}

}



?>

BTW, I'm pretty sure that I originally posted this in the bugs section, so I wonder why this could possibly not be considered a bug.

Hello ...

It has been moved because it's not a bug. Adjust the file exist rules in the favorite settings. Make sure the rules will not resume the file.

Regards,
SmartFTP

I see. Maybe someone should have been so kind and told me just that instead of only moving the topic? I also wonder why such rules exist (well hidden those settings) since they don't appear to be very useful. I doubt that it's wise to have defaults that lead to incorrect (or unwanted rather) behaviour of SmartFTP. I prefer reliability over speed if that is the reason