public static bool CreateFileFromBase64(string fileName, string Base64Data)
{
try
{
FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate);
byte[] data = Convert.FromBase64String(Base64Data);
fs.Write(data, 0, data.Length);
fs.Close();
return true;
}
catch (Exception ex)
{
logger.LogError("Error: " + ex.Message);
return false;
}
}
{
try
{
FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate);
byte[] data = Convert.FromBase64String(Base64Data);
fs.Write(data, 0, data.Length);
fs.Close();
return true;
}
catch (Exception ex)
{
logger.LogError("Error: " + ex.Message);
return false;
}
}
No comments:
Post a Comment