I'm trying to download a file (that can be either image or PDF) that I've saved in my DB. I get the file in a string format, so I want to download this file. The problem is, I don't get any error, it just doesn't show the downloaded file on its folder. Here is what I have so far.
string caminho = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string caminho_arquivo = Path.Combine(caminho, nome_arquivo);
var decoded = Encoding.UTF8.GetString(Convert.FromBase64String(arquivo.arquivo));
File.WriteAllText(caminho_arquivo, decoded);
The code below:
string caminho = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
would show the path like:
"/data/user/0/packagename/files/filename"
In Internal Storage, you couldn't see the files without root permission.
But you could use the code to check the file exist or not in the internal storage.
if (File.Exists(caminho_arquivo))
{
}
If you want to view it, you could use adb
tool. Please refer to the way in the link about the adb tool. How to write the username in a local txt file when login success and check on file for next login?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.