wassim safa

wassim safa

  • NA
  • 4
  • 2.2k

send file as a parameter to ajax call

Feb 25 2016 2:26 AM
hi,
sending file to controller is null
here what i am doing: 
i am trying to upload file to controller and then save it in sql table.
i am using : <td > <input type="file" id="DocumentContent" name="DocumentContent" /></td>
in view
and when click save i used this :
var row = { DocumentContent:document.getElementById('DocumentContent').files[0]}
and then send this row as parameter in ajax:
addrow: function (rowid, rowdata, position, commit) {
$.ajax({
url: urlAddDocument,
data: rowdata,
type: "Post",
success: function (data, status, xhr) {
// update command is executed.
flag = 1;
 
 

Answers (1)