Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understood you correct, you can use the following code to upload the file async. Modify it as you like</p> <pre><code>var AjaxFileUploader = function () { this._file = null; var self = this; this.uploadFile = function (uploadUrl, file) { var xhr = new XMLHttpRequest(); xhr.onprogress = function (e) { ... }; xhr.onload = function (e) { ... }; xhr.onerror = function (e) { ... }; xhr.open("post", uploadUrl, true); xhr.setRequestHeader("Content-Type", "multipart/form-data"); xhr.setRequestHeader("X-File-Name", file.name); xhr.setRequestHeader("X-File-Size", file.size); xhr.setRequestHeader("X-File-Type", file.type); xhr.send(file); }; }; AjaxFileUploader.IsAsyncFileUploadSupported = function () { return typeof (new XMLHttpRequest().upload) !== 'undefined'; } if (AjaxFileUploader.IsAsyncFileUploadSupported) { ajaxFileUploader = new AjaxFileUploader(); $("form").submit(function () { var uploader = $("#fileUploader")[0]; if (uploader.files.length == 0) { return; } else { ajaxFileUploader.uploadFile( "/YourUploadUrl", uploader.files[0]); } return false; }); } </code></pre> <p>To upload the form use the FormData class, populate it with form values and post it with XHR.</p> <p><strong>Update:</strong> For HTML4 try the following </p> <ul> <li><a href="http://www.albanx.com/?pid=5&amp;subid=21" rel="nofollow noreferrer">http://www.albanx.com/?pid=5&amp;subid=21</a></li> <li><a href="https://stackoverflow.com/questions/1276916/asynchronous-file-upload-ajax-file-upload-using-jsp-and-javascript">Asynchronous file upload (AJAX file upload) using jsp and javascript</a></li> </ul>
    singulars
    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