https://docs.microsoft.com/aspnet/core/tutorials/razor-pages/uploading-files
/aspnetcore/tutorials/razor-pages/uploading-files.md
The RP tutorial file upload sample currently saves the content of the file to the dB. That's fine; however, two devs have asked about saving the contents to disk server-side. We could add ...
Either way, the code will be something along the lines of ...
using (var fileStream = new FileStream(filePath, FileMode.Create))
{
await formFile.CopyToAsync(fileStream);
}
@Rick-Anderson @scottaddie I can knock this out within a week or two.
cc/ @Randall_Faldon
@guardrex I'm not sure we want to go down that rabbit hole. There's lots of problems/caveats with writing to a disk on the server. That's probably best left as a blog. @scottaddie may differ.
How about only showing that code snippet in the topic? We could leave it out of the sample entirely and just show the snippet as an example, then we could say that the worker process must have write permissions to that location on the server ... then leave it at that.
The thing I'm hearing is that devs would like us to at least show them what that little snippet of code just to save them some time trying to figure out what to do to get those file contents written.
Another approach would be not to do anything other than link to something; however, idk in our doc set where we show something like that that we could link to.
@danroth27 you OK with this?
Uploading files to a server/file share instead of the DB is quite common in my experience. I'd be okay with adding this code snippet and a brief description, but we'll let @danroth27 make the final call.
A link on how to save the file to Azure Storage instead of server disk would also be appreciated. Not sure if anything in the doc set supports that though. Thanks.
I think a quick link is possible. We could certainly look at it on review and see how it fares. I envision this section would then have:
Most helpful comment
Uploading files to a server/file share instead of the DB is quite common in my experience. I'd be okay with adding this code snippet and a brief description, but we'll let @danroth27 make the final call.