So I have the following method that I cannot alter:
public async Task<User> UploadSaa(string filepath, User user)
{
Assembly cesCommon = Assembly.GetExecutingAssembly();
byte[] saaBytes = null;
using (Stream saarStream = cesCommon.GetManifestResourceStream(name))
using (MemoryStream saaMemoryStream = new MemoryStream())
{
saaStream.CopyTo(saarMemoryStream);
saaBytes = saaMemoryStream.ToArray();
user.Saa = saaBytes;
}
user = await SaveNewUser(user);
return user;
}
In previous usages of it, filepath was passed directly to it in order to initialize the database for testing. However, now I need to find a way to pass a variable string to UploadSaa(), b/c in production, the user will be selecting their own file from their own system, and I can't dictate the filepath to them. I tried to use OpenFileDialog, but that returns a file, not a path
My questions are: How can I modify the OpenFileDialog to accept a path to a file, which can then be passed to UploadSaa? Is there a better option? If I must modify UploadSaa, what should the changes be?