Issue:
To Upload multiple files from Directory which matches the criteria like '.txt' '.exe' MIME Type.Solution:
To read all file from the Directory and uploading one by one. The code will be,#we specify the directory where all files that we want to upload are contained
$Dir=<Path of the Directory>
#ftp server
$ftp = <FTP Path>
$user = <UName>
$pass = <Passwd>
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass)
#list every sql server trace file
foreach($item in (dir $Dir "*.txt"))
{
"Uploading $item..."
$uri = New-Object System.Uri($ftp+$item.Name)
$webclient.UploadFile($uri, $item.FullName)
}
"Uploading $item..."
$uri = New-Object System.Uri($ftp+$item.Name)
$webclient.UploadFile($uri, $item.FullName)
}