public void Upload(IFormFile file){ FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://ftp.example.com/remote/path/file.zip"); request.Credentials = new NetworkCredential("username", "password"); request.Method = WebRequestMethods.Ftp.UploadFile; using (Stream ftpStream = request.GetRequestStream()) { file.CopyTo(ftpStream); }} 这篇关于通过HTTP将文件上传到ASP.NET,再上传到C#中的FTP服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-23 10:47