-
-
Save spir1donov/ecbf3da3525f5d7003d3c1cf07ab8a9d to your computer and use it in GitHub Desktop.
Revisions
-
nilcolor revised this gist
Jul 3, 2012 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ <form id="cpd-file" action="/upload_file" method="post" enctype="multipart/form-data"> <input type="file" name="cpd_file"> </form> -
nilcolor created this gist
Jul 3, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ function sendForm() { var fileData = new FormData(document.getElementById("cpd-file")); var xhr = new XMLHttpRequest(); xhr.open("POST", "/upload_file", true); xhr.setRequestHeader('Accept', 'application/json'); xhr.onload = function(progressEvent) { if (xhr.status == 200) { console.log('Uploaded', xhr); } else { console.log("Error " + xhr.status + " occurred uploading your file.", xhr); } }; xhr.send(oData); }