I am passing in a filename that I then want to request.files but it keeps returning null. Here is the code:

<div class="col-md-10">
      <input type="file" id="fileToUpload" name="fileToUpload" />
      <span class="field-validation-error" id="spanfile"></span>

and in the controller:

public ActionResult AddTechNote(TicketView ticketReturn, string Note, bool PublicNote, string fileToUpload, string CopyIntoEmail)
        HttpPostedFileBase file = Request.Files[fileToUpload];
        string _fileName = null;

        if (file != null && file.ContentLength > 0)
               _fileName = new FileController().UploadFile(file, "Tickets", ticketReturn.TicketNumber.ToString());

The view is not strongly typed (at least not to this model). The input field is inside a form.

Related posts

Recent Viewed