Caricamento file su FTP

' Il seguente script è un esempio di come si può caricare un file su un server FTP. Può essere utilizzato semplicemente cambiando i percorsi dei files. 

dim ok as boolean=true
dim msg as string=""
try
   dim FTP as System.Net.WebClient
   FTP = new System.Net.WebClient
   FTP.Credentials = new System.Net.NetworkCredential (<utente FTP>,<password>)
   Dim responseArray As Byte() = FTP.UploadFile("ftp://<host>/.../<nome file>", <percorso del file da caricare>)
   msg=System.Text.Encoding.ASCII.GetString(responseArray)
   if not empty(msg)
      ok=false
   End If
catch e as exception
   msg=e.message
   ok=false
End try

if not ok
   form.alert(msg)
else
   form.alert("Invio avvenuto con successo")
End If