Upload a file to FTP: Difference between revisions
Jump to navigation
Jump to search
Jkuehlthau (talk | contribs) (Created page with "void CSharpProcedure() { var client = new System.Net.WebClient(); string dt = DateTime.Now.ToString(); dt = dt.Replace("/","-"); dt = dt.Replace(" ","-"); dt = dt.Replace...") |
Jkuehlthau (talk | contribs) No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
=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'' | |||
<source lang="csharp"> | |||
void CSharpProcedure() | void CSharpProcedure() | ||
{ | { | ||
| Line 14: | Line 18: | ||
} | } | ||
} | } | ||
</source> | |||
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");
}
}