![](/img/trans.png)
[英]Invalid Viewstate, Invalid length for a Base-64 char array or string
[英]Exception coming When Converting Base64String to Byte array - Invalid length for a Base-64 char array or string
我有一個非常大的Base64
編碼字符串,文件大小約為50mb。我想將此文件保存在服務器上,我正在使用以下代碼將文件保存在服務器上,但出現異常:
例外:
"Invalid length for a Base-64 char array or string."
碼:
byte[] filebytes = Convert.FromBase64String(fileData);
File.WriteAllBytes(filePath, filebytes);
我認為由於Base64
字符串的大小過大,超出了字節數組的最大長度,請幫助我如何解決此問題,
嘗試這個:
byte[] filebytes = Convert.FromBase64String(fileData.Replace(" ","+"));
嘗試在fileData中將空字符串替換為'+'。 此異常通常是由於空字符串引起的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.