<input type="file" name="fileUpload1" id="fu1" /> <button type="button" id="clicker" value="Upload" name="Upload" >Upload</button> <progress id="prog1"></progress>
$("#clicker").live('click', function (e) { e.preventDefault(); UploadVideo("fu1", ""); }); function UploadVideo(elm, url) { var xhr = new XMLHttpRequest(); var fd = new FormData(); fd.append("fu1", document.getElementById("fu1").files[0]); xhr.addEventListener("progress", ProcessVideo, false); xhr.open("POST", "Handler.ashx"); xhr.send(fd); } function ProcessVideo(evt) { if (evt.lengthComputable) { var prog = document.getElementById("prog1"); prog.max = evt.total; prog.value = evt.loaded; } }
public void ProcessRequest (HttpContext context) { var file = context.Request.Files["fu1"]; var savePath = HttpContext.Current.Server.MapPath("~/teees/" + file.FileName); file.SaveAs(savePath); context.Response.ContentType = "text/plain"; context.Response.Write("Hello World"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)