0
두 개 이상의 파일을 업로드하려고하지만 연습을위한 단일 fileupload를 시도하고 있지만 예외가 발견되지 않았습니다. 내 작업은 아래와 같습니다.FileNotFoundException FTP를 사용하여
private static void UploadFileToFtp(string source)
{
String ftpurl = @"ftp://ftp.yuvarukhisamaj.com/wwwroot/Shtri/"; //“@ftpurl”; // e.g. ftp://serverip/foldername/foldername
String ftpusername = "yuvarukh";//“@ftpusername”; // e.g. username
String ftppassword = "CXhV5Rzeu";//“@ftppassword”; // e.g. password
try
{
string filename = Path.GetFileName(source);
string ftpfullpath = ftpurl;
FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(ftpfullpath);
ftp.Credentials = new NetworkCredential(ftpusername, ftppassword);
ftp.KeepAlive = true;
ftp.UseBinary = true;
ftp.Method = WebRequestMethods.Ftp.UploadFile;
FileStream fs = File.OpenRead(source);
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();
}
catch (Exception ex)
{
throw ex;
}
}
protected void Btn1_Click(object sender, EventArgs e)
{
String sourcefilepath = FileUpload1.FileName;
UploadFileToFtp(sourcefilepath);
}
오류 세부 정보는 An Exception of type “System.IO.FileNotFoundException” Occurred in Bshadow.DLL but was not handle in usercode
입니다. 추가 정보 : 파일을 찾을 수 없습니다. C:\Programfiles\Microsoft Visual Studio 8\IDE\dd.jpg
FTP를 통해 파일 업로드 프로그램으로 여러 파일을 업로드하려면 어떻게해야합니까?
Windows 탐색기에 C : \ Programfiles \ Microsoft Visual Studio 8 \ IDE \ dd.jpg를 붙여 넣을 때 파일을 볼 수 있습니까? – Sefa
@vgSefa, 아니요 "E : \ Asp.Net Test \ YuvaRK12 \ YuvaRK12 \ Shtri \ dd.jpg"에 있지만 C : \ Programfiles \ Microsoft Visual Studio 8 \ IDE \ dd.jpg에서는 사용할 수 없습니다 – user2741987
@ user2741987 글쎄 그게 당신 dosent 특정 위치에 존재하는 파일을로드하려고하는 문제. – dburner