This is a migrated thread and some comments may be shown as answers.

[Solved] radupload 2 file in server folder

0 Answers 140 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Krzysztof
Top achievements
Rank 1
Krzysztof asked on 25 Apr 2009, 10:11 PM
Hello I have got problems with radupload
I disadi to rename file that i save on the server.
1 step: i control tah file with this name is present in server folder
when not i save ther wit orginal name 
when is present i save with diferent name. 
My problem is that radcontrol is saving 2 time file wit orginal name text.txt and text1.txt 
I was used code writed by Petya

------- code by Petya----------

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        For Each file1 As UploadedFile In RadUpload1.UploadedFiles
            If (File.Exists(Server.MapPath(Path.Combine("files", file1.GetName())))) Then
                file1.SaveAs(Server.MapPath(Path.Combine("files", file1.GetNameWithoutExtension() + "1" + file1.GetExtension())), True)
            Else
                file1.SaveAs(Server.MapPath(Path.Combine("files", file1.GetName())))
            End If
        Next

    End Sub

---------------------------------------------------

I modificated code

-----------------My code--------------------

    Dim i As Integer
        i = 0

        For Each file1 As UploadedFile In uploadFly.UploadedFiles
            If (File.Exists(Server.MapPath(Path.Combine("upload/flv", file1.GetName())))) Then
                file1.SaveAs(Server.MapPath(Path.Combine("upload/flv", file1.GetNameWithoutExtension() + "1" + file1.GetExtension())), True)
            Else
                If i = 0 Then
                    i = 1
                    file1.SaveAs(Server.MapPath(Path.Combine("upload/flv/temp", file1.GetName())))
                    i = 1
                    i = 1
                    i = 1
                    i = 1
                    lab11.Text = i.ToString

                Else
                    file1.SaveAs(Server.MapPath(Path.Combine("upload/flv", file1.GetName())))

                End If
              
            End If
            Exit For
        Next


----------------------------------------------------------------
Always radupload do fro me 2 coy of file :( 

Using breadpoin i view that in any case loop "For each" is doing twice for this reasons i was insered "If i=0" when i=1 i change the directory but after first loop in memory i view always 0. Can you control this problem ??


-------------------------------------------Radupload on my page--------------------------
<br />
<telerik:RadUpload ID="uploadFly" Runat="server" Skin="Hay" MaxFileInputsCount="1"  OverwriteExistingFiles="false">
</telerik:RadUpload>
<br />

-------------------------------------------------------------------------------------------------------

Sorry for my english and thanks for help

No answers yet. Maybe you can help?

Tags
Upload (Obsolete)
Asked by
Krzysztof
Top achievements
Rank 1
Share this question
or