Joseph Longo
asked on
c# ftp code
using this code to upload to ftp but getting error:
c:/soapmessages/OUT/201704 21_xxxx.cs v
System.UriFormatException: Invalid URI: The format of the URI could not be deter
mined.
at System.Uri.CreateThis(Stri ng uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at System.Net.WebRequest.Crea te(String requestUriString)
at MYPROGRAM.Program.Main(Str ing[] args) in J:\mastersource\MYPROGRAM\ ConsoleApp lication2\ Program.cs :line 161
Press any key to exit.
c:/soapmessages/OUT/201704
System.UriFormatException:
mined.
at System.Uri.CreateThis(Stri
at System.Uri..ctor(String uriString)
at System.Net.WebRequest.Crea
at MYPROGRAM.Program.Main(Str
Press any key to exit.
fileName = "c:/soapmessages/OUT/" + var_yr + var_mth + var_day + "_xxxx.csv";
ftpFile = "ftp://" + ftpServerIP;
string ftpfullpath = Path.GetFileName(ftpFile);
FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(ftpfullpath); [b]<----- line 161[/b]
ftp.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
ftp.KeepAlive = true;
ftp.UseBinary = true;
ftp.Method = WebRequestMethods.Ftp.UploadFile;
FileStream fs = File.OpenRead(fileName);
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
fs.Close();
Stream ftpstream = ftp.GetRequestStream();
ftpstream.Write(buffer, 0, buffer.Length);
ftpstream.Close();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER