You want your file uploads to an FTP server to be protected as transactions, with atomicity and rollback and all that? It seems unlikely to me that you can achieve that. It certainly wasn't (and isn't) one of the design criteria for FTP. Perhaps
you should consider redesigning your application to use a more reliable protocol.