Hi.
I have a project for uploading files in Ajax & VBnet which works perfectly.
=ajax==========================
$("#upload").click(function () {
var data = new FormData();
for (var i = 0; i < selectedFiles.length; i++) {
data.append(selectedFiles[i].name, selectedFiles[i]);
}
$.ajax({
type: "POST",
url: "FileHandler.ashx",
contentType: false,
processData: false,
data: data,
success: function (result) {
alert(result);
},
error: function () {
alert("ERROR");
}
});
});
=VBNet==========================
Imports System.Web
Imports System.Web.Services
Public Class FileHandler
Implements System.Web.IHttpHandler
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
If (context.Request.Files.Count > 0) Then
Dim files As HttpFileCollection = context.Request.Files
For Each key As String In files
Dim file As HttpPostedFile = files(key)
Dim filename As String = file.FileName
filename = context.Server.MapPath("~/Uploaded/" + filename)
file.SaveAs(filename)
Next
End If
context.Response.ContentType = "text/plain"
context.Response.Write("OK")
End Sub
ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class
===============================
I would replace the my button and use the Webix component UPLOADER. I tried but I think something wrong.
var loadFile= {view: "uploader",id: "uploader_1",value: "Upload file",link: "mylist",upload: "<b>FileHandler.ashx</b>"}
var loadListFile= {view:"list", id:"mylist", type:"uploader",autoheight:true, borderless:true}
I have to use another method?
Thank you in advance for a solution …