Hello,
I have a RadAsyncUpload control on a webpage which opens in a radwindow and inserts the files into a database table. It works great and displays a checkmark unless you select a file larger than 5MB in which case you get an exclamation mark with no errors (javascript or otherwise).
The MaxFileSize is set to 0 (which should be unlimited) yet it does not work in developement or production.
Also,
Is there a way to have the control clear the temp file from the RadUploadTemp folder when the remove link is clicked or after i have put the files in the database?
---- UPLOADFORM.ASPX ----
<%@ Page Language="VB" Theme="Main" AutoEventWireup="false" CodeFile="UploadForm.aspx.vb" Inherits="UploadForm" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Upload Contract</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="Script1" runat="server" />
<telerik:RadFormDecorator ID="tfd1" runat="server" />
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Forest" />
Select file(s) to upload for Customer # <asp:Label ID="lblCustomerNumber" runat="server" Text="" />
<telerik:RadAsyncUpload ID="RadUpload1" runat="server" Skin="Forest"
ControlObjectsVisibility="RemoveButtons" MaxFileSize="0"
InputSize="40" MaxFileInputsCount="3" Width="475px" />
<br />
<table align="center">
<tr>
<td>
<asp:Button ID="btnUpload" runat="server" Text="Upload Files" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
---- UPLOADFORM.ASPX.VB ----
Imports Telerik.Web.UI
Imports System.Data.Sql
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Partial Class UploadForm
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lblCustomerNumber.Text = Session("CustomerID")
End Sub
Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
Dim CN As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("EnergyConnectionString").ToString)
CN.Open()
For Each File As UploadedFile In RadUpload1.UploadedFiles
Dim bytes(File.ContentLength - 1) As Byte
File.InputStream.Read(bytes, 0, File.ContentLength)
Dim cmd As New SqlCommand("INSERT INTO ContractFiles (CustomerID, FileName, FileExt, MIMEType, FileSize, DateAdded, FileData) VALUES (@CID, @FN, @FE, @MT, @FS, @DA, @FD)", CN)
cmd.Parameters.AddWithValue("@CID", "2976")
cmd.Parameters.AddWithValue("@FN", File.GetNameWithoutExtension())
cmd.Parameters.AddWithValue("@FE", File.GetExtension().ToString.Replace(".", ""))
cmd.Parameters.AddWithValue("@MT", File.ContentType())
cmd.Parameters.AddWithValue("@FS", File.ContentLength.ToString())
cmd.Parameters.AddWithValue("@DA", Now.ToString())
cmd.Parameters.AddWithValue("@FD", bytes)
cmd.ExecuteNonQuery()
'sdsFiles.DataBind()
'gvFiles.DataBind()
Next
CN.Close()
End Sub
End Class
Any assistance is greatly appreciated,
Thanks
I have a RadAsyncUpload control on a webpage which opens in a radwindow and inserts the files into a database table. It works great and displays a checkmark unless you select a file larger than 5MB in which case you get an exclamation mark with no errors (javascript or otherwise).
The MaxFileSize is set to 0 (which should be unlimited) yet it does not work in developement or production.
Also,
Is there a way to have the control clear the temp file from the RadUploadTemp folder when the remove link is clicked or after i have put the files in the database?
---- UPLOADFORM.ASPX ----
<%@ Page Language="VB" Theme="Main" AutoEventWireup="false" CodeFile="UploadForm.aspx.vb" Inherits="UploadForm" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Upload Contract</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="Script1" runat="server" />
<telerik:RadFormDecorator ID="tfd1" runat="server" />
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Forest" />
Select file(s) to upload for Customer # <asp:Label ID="lblCustomerNumber" runat="server" Text="" />
<telerik:RadAsyncUpload ID="RadUpload1" runat="server" Skin="Forest"
ControlObjectsVisibility="RemoveButtons" MaxFileSize="0"
InputSize="40" MaxFileInputsCount="3" Width="475px" />
<br />
<table align="center">
<tr>
<td>
<asp:Button ID="btnUpload" runat="server" Text="Upload Files" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
---- UPLOADFORM.ASPX.VB ----
Imports Telerik.Web.UI
Imports System.Data.Sql
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Partial Class UploadForm
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lblCustomerNumber.Text = Session("CustomerID")
End Sub
Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
Dim CN As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("EnergyConnectionString").ToString)
CN.Open()
For Each File As UploadedFile In RadUpload1.UploadedFiles
Dim bytes(File.ContentLength - 1) As Byte
File.InputStream.Read(bytes, 0, File.ContentLength)
Dim cmd As New SqlCommand("INSERT INTO ContractFiles (CustomerID, FileName, FileExt, MIMEType, FileSize, DateAdded, FileData) VALUES (@CID, @FN, @FE, @MT, @FS, @DA, @FD)", CN)
cmd.Parameters.AddWithValue("@CID", "2976")
cmd.Parameters.AddWithValue("@FN", File.GetNameWithoutExtension())
cmd.Parameters.AddWithValue("@FE", File.GetExtension().ToString.Replace(".", ""))
cmd.Parameters.AddWithValue("@MT", File.ContentType())
cmd.Parameters.AddWithValue("@FS", File.ContentLength.ToString())
cmd.Parameters.AddWithValue("@DA", Now.ToString())
cmd.Parameters.AddWithValue("@FD", bytes)
cmd.ExecuteNonQuery()
'sdsFiles.DataBind()
'gvFiles.DataBind()
Next
CN.Close()
End Sub
End Class
Any assistance is greatly appreciated,
Thanks