$(document).ready(function () {
$("#Buttonsave").click(function (evt) {
var fileUpload = $("#FileUpload1").get(0);
var files = fileUpload.files;
var data = new FormData();
for (var i = 0; i < files.length; i++) {
data.append(files[i].name, files[i]);
}
var options = {};
options.url = "fileuploadHandler.ashx";
options.type = "POST";
options.data = data;
options.contentType = false;
options.processData = false;
options.success = function (result) {
var urls = result.split('|');
var imgs = $.map(urls, function (url) {
// return $("<img />").attr("src", url);
return $("<img />").attr({ "src": url, "id": "img_" });
});
$("#imagesPlaceholder").append(imgs);
};
options.error = function (err) { alert(err.statusText); };
$.ajax(options);
evt.preventDefault();
});
}); |