Good evening everyone, my query is as follows.
I have an asp.net web forms form on vb.net where I have an asp: fileupload control like this:
<asp:FileUpload ID="UpLoadEstudiantes" runat="server"
AllowMultiple="False" CssClass="fileContainer"/>
What I want in the code behind is to get that file from the fileupload and convert it to an array of bytes to send it to a method that receives this array of bytes and processes it.
The problem is that I try to get the contents of the fileupload and convert it to a byte array but I can not get through the array of bytes with the file.
This is one of the ways you try to fill an array of bytes with the contents of the fileupload.
Dim ms As New MemoryStream()
UpLoadEstudiantes.PostedFile.InputStream.CopyTo(ms)
Dim byts = ms.ToArray()
ms.Dispose()
and I have this error frequently when using the InputStream or the ContentFile.