Azure 文件存储在删除本地副本之前上传后验证文件
Azure File storage validate file after upload before deleting local copy
我们正在将数据迁移到 Azure 文件存储,并希望在上传完成后验证上传,然后再从本地服务器删除文件。
下面的代码工作正常,但我从文档中不太清楚之后如何验证文件。
我本来打算比较字节数,但看起来使用 transactionalCRC 可以,但我似乎无法实现它
byte[] theFile = UploadHelper.GetFileAsByteArray(theUpload);
CloudFile theCloudFile = rootDir.GetFileReference(theUpload.Name);
Stream theMemoryStream = new MemoryStream(theFile);
await theCloudFile.UploadFromStreamAsync(theMemoryStream);
或者,如果我对此考虑过度,并且有更好的方法,我将不胜感激。
谢谢,
关于如何验证文件完整性的问题在此处有一个普遍接受的答案:
Calculate MD5 checksum for a file
我们正在将数据迁移到 Azure 文件存储,并希望在上传完成后验证上传,然后再从本地服务器删除文件。
下面的代码工作正常,但我从文档中不太清楚之后如何验证文件。
我本来打算比较字节数,但看起来使用 transactionalCRC 可以,但我似乎无法实现它
byte[] theFile = UploadHelper.GetFileAsByteArray(theUpload);
CloudFile theCloudFile = rootDir.GetFileReference(theUpload.Name);
Stream theMemoryStream = new MemoryStream(theFile);
await theCloudFile.UploadFromStreamAsync(theMemoryStream);
或者,如果我对此考虑过度,并且有更好的方法,我将不胜感激。
谢谢,
关于如何验证文件完整性的问题在此处有一个普遍接受的答案:
Calculate MD5 checksum for a file