tags:

views:

11

answers:

0

Hi Guys i am using the below code to do upload all files from a folder here it is working in my local machine but when i upload from server it shows error....

Dim ServerFileName As String

    If file1.PostedFile.FileName <> "" Then
        Dim fileList As New ArrayList()

        Dim dirNameWithPath As String = Path.GetDirectoryName(file1.PostedFile.FileName)
        Dim files As String() = Directory.GetFiles(dirNameWithPath)

        For Each str As String In files
            fileList.Add(System.IO.Path.GetFileName(str))
        Next

        For Each str As String In fileList
            ServerFileName = Path.Combine(SERVER_FOLDER, Path.GetFileName(str))
            file1.PostedFile.SaveAs(ServerFileName)
        Next
    End If