예제 #1
0
    }                                                                              // ファイルとかの削除

    public void AddStr(string URL, string text)
    {
        try
        {
            DIRMAKES(URL);
            FtpWebRequest request = (FtpWebRequest)WebRequest.Create(new Uri(GetRootURL + URL));
            request.Method = WebRequestMethods.Ftp.AppendFile;
            byte[] fileContents = Encoding.UTF8.GetBytes(text);
            request.ContentLength = fileContents.Length;
            request.Credentials   = new NetworkCredential(user_, pass_);
            Stream requestStream = request.GetRequestStream();
            requestStream.Write(fileContents, 0, fileContents.Length);
            requestStream.Close();
            FtpWebResponse response = (FtpWebResponse)request.GetResponse();
            response.Close();
            requestStream.Dispose();
        }
        catch (Exception e)
        {
            Error?.Invoke(e.Message);
        }
        ///res(URL, WebRequestMethods.Ftp.AppendFile);
    }