I have a Telerik component I am using to collect files for upload to an sftp server.
<TelerikUpload @ref="files" AutoUpload="false" Multiple="true" OnUpload="@(Submit)" OnCancel="@(Cancel)" MaxFileSize="MaxFileSize" Enabled="@(string.IsNullOrEmpty(StatusMessage))"></TelerikUpload>I'm using this event to process when the upload button has been clicked:
private async Task Submit(UploadEventArgs args){ foreach (var file in args.Files) { await provider.Upload(file.Name); }}Upload is then doing the following:
string downloadsPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) +"\\Downloads";string localFilePath = Path.Combine(downloadsPath, fileName);using (var fileStream = new FileStream(localFilePath, FileMode.Open, FileAccess.Read)){ await Task.Run(() => sftp.UploadFile(fileStream, fileName), cancel);}Now this works just fine. The problem I have is in my scenario I won't have access to the users local machine so I can't get the file path like I'm doing above. I need solutions where I can open a memory stream in the front end and have it passed back to the API.