CSharpUtils.Net.FTP.OpenUpload C# (CSharp) Method

OpenUpload() public method

Open an upload with resume support
public OpenUpload ( Stream _file, string remote_filename, bool resume = false ) : void
_file Stream Local file to upload (Can include path to file)
remote_filename string Filename to store file as on ftp server
resume bool Attempt resume if exists
return void
		public void OpenUpload(Stream _file, string remote_filename, bool resume = false)
		{
			Connect();
			SetBinaryMode(true);
			OpenDataSocket();

			bytes_total = 0;

			file = _file;
			file_size = _file.Length;

			if (resume)
			{
				long size = GetFileSize(remote_filename);
				SendCommand("REST " + size);
				ReadResponse();
				if (response == 350)
					file.Seek(size, SeekOrigin.Begin);
			}

			SendCommand("STOR " + remote_filename);
			ReadResponse();

			switch (response)
			{
				case 125:
				case 150:
					break;
				default:
					file.Close();
					file = null;
					throw new Exception(responseStr);
			}
			ConnectDataSocket();		// #######################################	

			return;
		}

Same methods

FTP::OpenUpload ( string filename, string remote_filename, bool resume = false ) : void