Upload a file to FTP: Difference between revisions
Jump to navigation
Jump to search
Jkuehlthau (talk | contribs) No edit summary |
Jkuehlthau (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
=External Assemblies= | =External Assemblies= | ||
To | To upload a file in a C# scripted function, you must first go to the .NET Global section, and in the External Assemblies box, enter the following: ''System.dll'' | ||
<source lang="csharp"> | <source lang="csharp"> |
Latest revision as of 03:08, 21 September 2018
External Assemblies
To upload a file in a C# scripted function, you must first go to the .NET Global section, and in the External Assemblies box, enter the following: System.dll
void CSharpProcedure() { var client = new System.Net.WebClient(); string dt = DateTime.Now.ToString(); dt = dt.Replace("/","-"); dt = dt.Replace(" ","-"); dt = dt.Replace(":","-"); string URI = "ftp://ftp.site.com/PDFs/PDF-"+dt+".pdf"; Starfish.LogMessage(URI); using (client) { client.Credentials = new System.Net.NetworkCredential("username", "password"); client.UploadFile(URI, System.Net.WebRequestMethods.Ftp.UploadFile, @"C:\Results\NCOA\NCOA_CASS.pdf"); } }