I have a web page built with Asp.net where users can upload pictures. However, when I try to access the uploaded files using Request.Files
in my code-behind, it returns a count of 0. Strangely, when I check using JavaScript, it does show that a file has been uploaded. How can I access this file in the code-behind?
Here is the Asp.net code:
<div class="custom-file">
<input type="file" ID="FileUploadPictureStudent" class="custom-file-input"
aria-describedby="FileUploadPictureStudent"name="FileUploadPictureStudent" runat="server"
onchange="fileUploadhandeler(this);" />
<asp:Label runat="server" class="custom-file-label" for="FileUploadPictureStudent" Text="Choose file" ID="Fileuploadhelper"></asp:Label>
</div>
Vb.Net Code
Dim HelperLabel = Request.Files.Count.ToString()
The output on the page shows 0.
When checking with JavaScript using the command
document.getElementById('FormViewAddStudent_FileUploadPictureStudent').files
in the console, the output is as follows:
FileList {0: File, length: 1, item: function} = $1
Thank you in advance for your help