Please Fix Your Input File to have a way to save the file to disk.
See original GitHub issueThis may not be a bug, but after 3 days of trying your IBrowserFile returned by the InputFile component for blazor does not have a SaveAsAsync feature.
Your stream that is returned does not have any way to save. When I try to convert the stream to a FileStream, I get a Task was cancelled whether or not I use a cancellation token.
Why would you not design this component to use a System.IO.File object, so you can easily be saved?
Please provide an easy example of saving the file uploaded to the upload folder in Blazor. Your Sample provided uses a Person object, which has a Picture property which is an IBrowserFile, which is the problem I am having. I saw someone had an example of how to save to a BlobStorage with blob.UploadAsync(), so if that can be done, IBrowserFile.SaveAsync(path) would be the simplest solution.
My code is here if you can tell me how to update this Nuget package to .Net 5 I will update it, else I have to stay on .Net Standard for file uploads.
(this may or may not be converted to .Net 5, not sure if I checked in what ISN"T WORKING). https://github.com/DataJuggler/BlazorFileUpload
Really don’t see why IBrowserFile was created if it doesn’t have SaveAsAsync is it useless, and I have to stay on Steve Sanderson’s BlazroFileInput which hasn’t been updated since Preview 3 of Blazor.
Thank you, I wasted a weekend and can’t waste any more time. Your stream object is not easy to work with, nor is IBrowserFile.
Steve Sanderson’s Blazor File Input worked out of the box, I never had any problems till I tried to switch to .Net 5.
Thank you, this is a bug, not a feature request, because if it worked, I wouldn’t be here.
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Exceptions (if any)
Further technical details
- ASP.NET Core version
- Include the output of
dotnet --info
- The IDE (VS / VS Code/ VS4Mac) you’re running on, and it’s version
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
I went back and looked at my code that was working, and it had a memory stream.
I got it working with this:
Sorry if my people skills are lacking when I get tired. An example like the above would have helped me 3 days ago when I had time to work on this for 20 minutes, and it turned into a weekend problem.
I still think a File.SaveAsAsync(path) would be simpler than expecting every consumer of an IBrowserFile to have to figure out something like the above.
Just my thought, I know my simple brain would have found SaveAs with Intellisense when I wanted to save, and that would have been the amount I wanted to know.
Thank you, just think calling one method is easier than copying streams.
Corby
From: Javier Calvarro Nelson notifications@github.com Sent: Monday, November 30, 2020 7:32 AM To: dotnet/aspnetcore aspnetcore@noreply.github.com Cc: Corby Nichols corby@datajuggler.com; Mention mention@noreply.github.com Subject: Re: [dotnet/aspnetcore] Please Fix Your Input File to have a way to save the file to disk. (#28244)
Yes
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/aspnetcore/issues/28244#issuecomment-735787257, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGI4P7MS272JKUZQ2NQSWJTSSONETANCNFSM4UHKORCA.
Yes