Upload a file to FTP or sFTP

Upload a file to FTP or sFTP

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");
	}
}
    • Related Articles

    • File System Connector

      File System Origin The File System Connector reads all files from a folder specified in the Directory field. The Username and Password fields are not used. Filter can be used to filter for certain file names/extensions. To search for all files with ...
    • Import Starfish Map file from a locally stored *.SPD file

      Import Starfish Map file from a locally stored *.SPD file Step Snapshot Go to project and select the Import view Select Browse to import the *.spd file Select *.spd file from directory folder. Once the import is complete, the project will be added to ...
    • Download File

      External Assemblies To download a file in a C# scripted function, you must first go to the .NET Global section (after you choose to create a global script as found HERE), and in the External Assemblies box, enter the ...
    • Interact with the local file system

      Read files from a folder Function ScriptedVariable Dim fso, folder, files, sFolder, res Set fso = CreateObject("Scripting.FileSystemObject") sFolder = "C:\Results" Set folder = fso.GetFolder(sFolder) Set files = folder.Files For each folderIdx In ...
    • Pull data from a source and write to file

      With this map, I wanted to pull all accounts from a Sugar instance and dump a few fields into a pipe delineated file. In this map I used the same Sugar instance as both the Origin and Destination. There were no Stages created, so no action was taken ...