How to get data (read file) chosen in FileUpload control without FileUpload.SaveAs Method on the server? Is it possible write it at once to some object?
Using FileUpload.FileContent gives you a Stream to work with.
See MSDN.
For example:
void WriteFileLength()
{
if (fileUpload.HasFile)
{
var fileStream = fileUpload.FileContent;
var messageFormat = "The file is {0} bytes in length"
Response.Write(string.Format(messageFormat, fileStream.Length));
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With