Posted 02 Nov 2010 Link to this post
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="admin_Default" %>
<%@ 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
>Untitled Page</
</
body
form
id
"form1"
div
telerik:RadScriptManager
ID
"RadScriptManager1"
telerik:RadAjaxPanel
"RadAjaxPanel1"
LoadingPanelID
"RadAjaxLoadingPanel1"
HorizontalAlign
"NotSet"
Please select a file:
asp:FileUpload
"FileUpload1"
/><
br
/>
asp:Button
"upload"
Text
"Upload"
asp:Label
"output"
></
telerik:RadAjaxLoadingPanel
Height
"75px"
Transparency
"10"
BackgroundPosition
"Center"
img
alt
"Loading..."
src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.LoadingProgressBar.gif") %>'
style="border: 0px;" />
Partial
Class
admin_Default
Inherits
System.Web.UI.Page
Protected
Sub
upload_Click(
ByVal
sender
As
Object
,
e
System.EventArgs)
Handles
upload.Click
Response.Write(
"test"
)
If
(FileUpload1.HasFile)
Then
Try
Dim
name
String
= FileUpload1.FileName.ToString
ext
= System.IO.Path.GetExtension(FileUpload1.FileName)
(ext =
".csv"
FileUpload1.SaveAs(Server.MapPath(
"~/admin/temp/"
& name))
Else
output.Text =
"<span style='color: red;'>Invalid file type. File must be CSV.</span>"
End
'if ext = .csv
Catch
ex
Exception
Response.Write(ex.ToString)
'fileupload.hasfile
output.Text = (
"<span style='color: red;'>Please make sure you have selected a file and the size is greater than 0 bytes.</span>"
Posted 03 Nov 2010 Link to this post