Hi,
i'm trying to implement UploadBox as found in the documentation. however after selecting one or multiple files, nothing is happening... My uploadaction is not called. this is my code:
ConfigController
Function FileUpload() As ActionResult
Dim myModel As New UploadBoxModel
myModel.AutoUpload = True
myModel.AllowMultipleFiles = True
myModel.ExtensionsAllow = "txt"
ViewData("upload") = myModel
Return View()
End Function
<HttpPost> _
Function SaveFile(upload As IEnumerable(Of HttpPostedFile)) As ActionResult
For Each uFile In upload
Dim fileName = Path.GetFileName(uFile.FileName)
Dim destinationPath = Path.Combine(Server.MapPath("~/App_Data/Uploads"), fileName)
uFile.SaveAs(destinationPath)
Next
Return Content("")
End Function
Function RemoveFile(fileNames As String()) As ActionResult
For Each fullName In fileNames
Dim fileName = Path.GetFileName(fullName)
Dim physicalPath = Path.Combine(Server.MapPath("~/App_Data/Uploads"), fileName)
If System.IO.File.Exists(physicalPath) Then
System.IO.File.Delete(physicalPath)
End If
Next
Return Content("")
End Function
File Upload View (Razor)
<h2>FileUpload</h2>
@code
Dim foo = Html.Syncfusion.UploadBox("upload").AsyncUpload(Function(a) a.SaveAction("SaveFile", "Config").RemoveAction("RemoveFile", "Config").AutoUpload(True)).CustomCSS("CustomCss-UploadBox").ShowFileDetails(True)
foo.Render()
End Code
<style type="text/css">
#browse {
margin: 30px 0 50px;
}
</style>
@code
Dim styleManager = Html.Syncfusion.StyleManager
styleManager.Register(Function(register) register.Add(ComponentType.UploadBox))
styleManager.Minify = True
styleManager.Render()
End Code
thanks for your help
kind regards
lc