Hi,
when I upload the image is sent but does not appear radprogressarea, why?
when I upload the image is sent but does not appear radprogressarea, why?
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
Runat
=
"server"
>
</
telerik:RadScriptManager
>
<
telerik:RadProgressManager
ID
=
"RadProgressManager1"
Runat
=
"server"
/>
<
br
/>
<
table
style
=
"width:100%;"
>
<
tr
>
<
td
>
<
telerik:RadUpload
ID
=
"RadUpload1"
Runat
=
"server"
AllowedFileExtensions
=
".jpg,.jpeg"
OverwriteExistingFiles
=
"True"
TargetFolder
=
"image/image_utenti"
>
</
telerik:RadUpload
>
</
td
>
<
td
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
"Nessun file caricato"
></
asp:Label
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
telerik:RadProgressArea
ID
=
"RadProgressArea1"
Runat
=
"server"
>
</
telerik:RadProgressArea
>
</
td
>
<
td
>
<
asp:Repeater
ID
=
"Repeater1"
runat
=
"server"
Visible
=
"False"
>
<
HeaderTemplate
>
<
div
class
=
"title"
>
File caricato:</
div
>
</
HeaderTemplate
>
<
ItemTemplate
>
<%#DataBinder.Eval(Container.DataItem, "FileName")%>
<%#DataBinder.Eval(Container.DataItem, "ContentLength").ToString() + " bytes"%>
<
br
/>
</
ItemTemplate
>
</
asp:Repeater
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Button"
/>
</
td
>
<
td
>
</
td
>
</
tr
>
</
table
>
</
div
>
</
form
>
Imports
System
Imports
System.Collections
Imports
System.ComponentModel
Imports
System.Data
Imports
System.Drawing
Imports
System.IO
Imports
System.Web
Imports
System.Web.SessionState
Imports
System.Web.UI
Imports
System.Web.UI.WebControls
Imports
System.Web.UI.HtmlControls
Imports
Telerik.Web.UI
Public
Class
UploadImgCard
Inherits
System.Web.UI.Page
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
End
Sub
Protected
Sub
Button1_Click(sender
As
Object
, e
As
EventArgs)
Handles
Button1.Click
If
RadUpload1.UploadedFiles.Count > 0
Then
Repeater1.DataSource = RadUpload1.UploadedFiles
Repeater1.DataBind()
Label1.Visible =
False
Repeater1.Visible =
True
Else
Label1.Visible =
True
Repeater1.Visible =
False
End
If
End
Sub
Private
callBack
As
CacheItemRemovedCallback
Private
Sub
AddDeleteDependencyForFile(
ByVal
uploadedFileCollection
As
UploadedFileCollection)
Dim
uploadedFile
As
UploadedFile
For
Each
uploadedFile
In
uploadedFileCollection
Dim
timeOut
As
TimeSpan = TimeSpan.FromMinutes(5)
callBack =
New
CacheItemRemovedCallback(
AddressOf
DeleteFile)
Dim
fullPath
As
String
= Path.Combine(Server.MapPath(RadUpload1.TargetFolder), uploadedFile.GetName())
Context.Cache.Insert(uploadedFile.FileName, fullPath,
Nothing
, DateTime.Now.Add(timeOut), TimeSpan.Zero, CacheItemPriority.
Default
, callBack)
Next
End
Sub
Private
Sub
DeleteFile(
ByVal
key
As
String
,
ByVal
path
As
Object
,
ByVal
reason
As
CacheItemRemovedReason)
File.Delete(
DirectCast
(path,
String
))
End
Sub
Protected
Sub
RadUpload1_FileExists(sender
As
Object
, e
As
Telerik.Web.UI.Upload.UploadedFileEventArgs)
Handles
RadUpload1.FileExists
Dim
counter
As
Integer
= 1
Dim
file
As
UploadedFile = e.UploadedFile
Dim
targetFolder
As
String
= Server.MapPath(RadUpload1.TargetFolder)
Dim
targetFileName
As
String
= Path.Combine(targetFolder, file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension())
While
System.IO.File.Exists(targetFileName)
counter += 1
targetFileName = Path.Combine(targetFolder, file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension())
End
While
file.SaveAs(targetFileName)
End
Sub
End
Class