I am trying to upload a pdf file using the nuget package filepicker.
I’m able to getting the file name & file local path.
But when I am trying to convert the file to a byte array I am getting an error.
It's my pcl Code-
public interface ILoclFileProvider
{
byte[] GetFileBytes(string path);
}
public static class FileUtility
{
public static ILoclFileProvider FileSystem { get; set; }
public static void SetUp(ILoclFileProvider fs)
{
FileSystem = fs;
}
}
This is my Droid Project code-
public class LocalFileProvider_Droid : ILoclFileProvider
{
public byte[] GetFileBytes(string filePath)
{
return File.ReadAllBytes(filePath);
}
}
and in my pcl project I'm calling this-
var bytes = FileUtility.FileSystem.GetFileBytes(filePath);
and I'm getting an error-
Object reference not set to an instance of an object.
what is wrong in my code?