使用方法:
上传图片到ftp
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using RCP.Web.Common;
namespace Import_Advtisement
{
class FileTransfer
{
public string sendPicture(string filename,string dirname,string city)
{
FTPUtils ftp = new FTPUtils("192.168.0.157", "zoe", "123456");
// string filename = this.FileUpload1.FileName.Trim();
// string filename = this.FileUpload1.PostedFile.FileName.Trim();
// string mappath = Server.MapPath(filename);
//ftp.Connect("ftp://" + "192.168.0.46");
string[] list = ftp.GetFileList();
string result_upload = ftp.Upload(filename, dirname,false);
//ftp.DeleteFileName(result_upload);
//ftp.MakeDir("img_new/img2_new");
//ftp.Rename("img", "img_new");
//string[] list1 = ftp.GetFilesDetailList();
return result_upload;
}
}
} |