I am using the following pasted code for the handler. It was authored quite awhile ago. The new filename for multiple files is not changing. That is if two files are uploaded at the same time, only one filename is returned for both.
How can I adjust this to fix that.
Public
Class
agUploadHandler
Inherits
Telerik.Windows.RadUploadHandler
Private
newfilename
As
String
=
String
.Empty
Public
Overrides
Property
TargetPhysicalFolder()
As
String
Get
Return
Security.SystemDirs(Datum.eSystemDirs.Upload)
Return
MyBase
.TargetPhysicalFolder
End
Get
Set
(
ByVal
value
As
String
)
MyBase
.TargetPhysicalFolder = Security.SystemDirs(Datum.eSystemDirs.Upload)
End
Set
End
Property
Public
Overrides
Function
GetAssociatedData()
As
System.Collections.Generic.Dictionary(Of
String
,
Object
)
Dim
dict
As
System.Collections.Generic.Dictionary(Of
String
,
Object
) =
MyBase
.GetAssociatedData
If
IsNothing(newfilename) =
False
AndAlso
newfilename <>
String
.Empty
Then
dict.Add(
"NewFileName"
, newfilename)
End
If
Return
dict
End
Function
Protected
ReadOnly
Property
Security()
As
Datum.ISecurity
Get
' this was shoved on the thread at login
If
IsNothing(_Security)
Then
_Security = Datum.EntityHelper.getSecurity(
True
)
End
If
Return
_Security
End
Get
End
Property
Protected
_Security
As
Datum.ISecurity =
Nothing
Public
Overrides
Sub
ProcessStream()
If
IsNewFileRequest()
Then
ResultChunkTag = Guid.NewGuid.ToString
ElseIf
FormChunkTag <>
Nothing
Then
ResultChunkTag = FormChunkTag
End
If
MyBase
.ProcessStream()
End
Sub
Public
Overrides
Function
GetFilePath(
ByVal
fileName
As
String
)
As
String
fileName =
MyBase
.GetFilePath(GetFilename(fileName))
Return
fileName
End
Function
Private
Shadows
Function
GetFilename(
ByVal
filename
As
String
)
As
String
If
ResultChunkTag <>
Nothing
Then
filename = ResultChunkTag & System.IO.Path.GetExtension(filename)
End
If
newfilename = filename
Return
filename
End
Function
End
Class