I need to write a filestream to an FTP path. Is this possible? Am I just doing it wrong?
FTP path =
C# (Hope that does not matter) Code is as follows:Code:FTP://username:password@###.###.###.###/foldername/file.docx
Code:public Boolean CopyDoc(string OldDoc, string NewDoc) { try { byte[] byteArray = File.ReadAllBytes(OldDoc); using (MemoryStream mem = new MemoryStream()) { mem.Write(byteArray, 0, (int)byteArray.Length); using (FileStream fileStream = new FileStream(NewDoc, System.IO.FileMode.CreateNew)) { mem.WriteTo(fileStream); } } return true; } catch (IOException e) { string myerrmsg = "The file '" + NewDoc + "' already exists."; if (e.Message == myerrmsg) { throw new IOException(myerrmsg); } else { throw new IOException(e.Message); } return false; } catch (Exception e) { throw new Exception(e.Message); return false; } }
Error i get:
Code:The given path's format is not supported.




Reply With Quote



