Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Instead of Jquery Ajax you could use</p> <pre><code> &lt;script&gt; function SubmitButtonOnclick() { var formData= new FormData(); var imagefile=document.getElementById("imageFile").files[0]; var coverfile=document.getElementById("coverFile").files[0]; formData.append("imageFile",imageFile); formData.append("coverFile",coverFile); var xhr = new XMLHttpRequest(); xhr.open("POST", "/Profile/EditProfile", true); xhr.addEventListener("load", function (evt) { UploadComplete(evt); }, false); xhr.addEventListener("error", function (evt) { UploadFailed(evt); }, false); xhr.send(formData); } function UploadComplete(evt) { if (evt.target.status == 200) alert("Logo uploaded successfully."); else alert("Error Uploading File"); } function UploadFailed(evt) { alert("There was an error attempting to upload the file."); } &lt;/script&gt; </code></pre> <p>This works for me !!</p> <p>Your script with changes</p> <pre><code> function SubmitButtonOnclick() { var formData = new FormData(); var file = document.getElementById("imageFile").files[0]; var file1 = document.getElementById("coverFile").files[0]; formData.append("imageFile", file); formData.append("coverfile", file1); $.ajax({ type: "POST", url: '@Url.Action("EditProfile","Default1")', data: formData, dataType: 'json', contentType: false, processData: false, success: function (response) { $('#GeneralSection').html(response.responseText); }, error: function (error) { $('#GeneralSection').html(error.responseText); } }); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload