[英]Calculate MD5 checksum for a file after FTP upload
I want to perform the checksum MD5 control after the upload of file to FTP(S) server. 将文件上传到FTP(S)服务器后,我想执行校验和MD5控制。
What steps should I follow in C#? 我应该在C#中执行哪些步骤? I think I have to use the
XMD5
command on FTPS server and get the result. 我想我必须在FTPS服务器上使用
XMD5
命令并获得结果。
But I do not know how to do it. 但是我不知道该怎么做。
Thanks 谢谢
You cannot execute random FTP commands using .NET FtpWebRequest
, nor any other built-in .NET class. 您不能使用.NET
FtpWebRequest
或任何其他内置的.NET类执行随机FTP命令。
You have to use a 3rd party FTP library for this. 您必须为此使用第三方FTP库。
For example WinSCP .NET assembly has Session.CalculateFileChecksum
method . 例如WinSCP .NET程序集具有
Session.CalculateFileChecksum
方法 。 The method will automatically map checksum algorithm name (as "md5") to an FTP command that the server supports. 该方法将自动将校验和算法名称(作为“ md5”)映射到服务器支持的FTP命令。 So if the server supports
XMD5
, it will use XMD5
. 因此,如果服务器支持
XMD5
,它将使用XMD5
。
(I'm the author of WinSCP) (我是WinSCP的作者)
For some background, see also my answer to: 对于某些背景,另请参阅我的回答:
FTP: copy, check integrity and delete FTP:复制,检查完整性并删除
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.