我正在尝试将文件拆分成碎片,然后将每个共享上传到blob存储中,这是我到目前为止的代码。
[HttpPost]
public ActionResult Upload(HttpPostedFileBase image)
{
int n = 5, t = 3;
RandomSources r = RandomSources.SHA1;
Encryptors e = Encryptors.ChaCha20;
Algorithms a = Algorithms.CSS;
if (image.ContentLength > 0)
{
Facade f = new Facade(n, t, r, e, a);
Byte[] bytes = ObjectToByteArray(image.InputStream);
Share[] shares = f.split(bytes);
foreach (Share share in shares)
{
byte[] serialized = share.serialize();
}
CloudBlobContainer blobContainer = _blobStorageService.GetCloudBlobContainer();
CloudBlockBlob blob = blobContainer.GetBlockBlobReference(image.FileName);
blob.UploadFromByteArray(bytes, 0, bytes.Length);
blob.UploadFromStream(serialized);
}
return RedirectToAction("Upload");
}
有没有人有任何关于如何改变这一点的建议,因为当我尝试使用上传表格时它不起作用并且不会产生任何错误。