Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
JavaScript pass null input file type in ASP.NET Core

I have dynamic inputs

The code works properly, but the input file type passed null

the AttachmentsDto ,,,

 public class AttachmentsDto
    {
        public string Name { get; set; }
        public int AttachType { get; set; }
        public List<IFormFile> Photos { get; set; }
        public string? CreatedBy { get; set; }
        public string? ModifiedBy { get; set; }
        public DateTime CreatedOn { get; set; }
        public DateTime? ModifiedOn { get; set; }
        public bool IsDeleted { get; set; } = false;
    }

the photos input #Photos file passed null, Although input #Name pass the value

  <script>
        $("#addRow").click(function ()
        {
        var rowCount = parseInt($("#total").val());
        rowCount++;
        $("#total").val(rowCount);
        console.log(rowCount);
        var html = '';
        html += '<div id="inputRow">';
        html += '<input type="text" name="DynamicNoteList[' + (rowCount - 1) + '].Note"  class="form-control " />';
        html += '</br>';
        html += '<input type="file" id="Photos" name="Attachments[' + (rowCount - 1) + '].Photos" multiple="multiple"  class="form-control custom-file-input"/>';
        html += '<input type="text" name="Attachments[' + (rowCount - 1) + '].Name" id="Name " class="form-control"/>';
    
        //add more inputs here...
        html += '<button id="removeRow" type="button" class="btn btn-danger">Delete</button>';
        html += '</div>';
    
        $('#newRow').append(html);
        });
        $(document).on('click', '#removeRow', function ()
        {
        var rowCount = parseInt($("#total").val());
        rowCount--;
        $("#total").val(rowCount);
        $(this).closest('#inputRow').remove();
        });
    
    </script>
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!