am using RadAsyncUpload to upload flles to the server and want to check if file name exist on client side then javascript popup to confirm overwrite or change file name by adding +1 to the filename.
I tried to use these script on server side and also didn't goes well for me .
Protected
Sub
RadAsyncUpload1_FileUploaded(
ByVal
sender
As
Object
,
ByVal
e
As
FileUploadedEventArgs)
Dim
targetFolder
As
String
=
"~/Files"
Dim
targetFileName
As
String
= Path.Combine(Server.MapPath(targetFolder), e.File.GetName())
If
Not
File.Exists(targetFileName)
Then
e.File.SaveAs(targetFileName)
txtpath.Text = targetFileName
' Implement logic
Else
lbresult.Text =
"failed to upload"
End
If
End
Sub
and also this code :
Private
Sub
RadAsyncUpload1_FileUploaded(
ByVal
sender
As
Object
,
ByVal
e
As
FileUploadedEventArgs)
Dim
fullPath
As
String
= Server.MapPath(Path.Combine(RadAsyncUpload1.TargetFolder, e.File.GetName()))
If
File.Exists(fullPath)
Then
e.IsValid =
False
e.File.SaveAs(Server.MapPath(Path.Combine(RadAsyncUpload1.TargetFolder, e.File.GetNameWithoutExtension() &
"1"
& e.File.GetExtension())))
txtpath.Text =
"http://www.xxxxx.org/Files/"
& e.File.FileName
End
If
End
Sub