i have asp.net web page has fileupload to let user upload any file he want from his pc to web site ftp
the problem is that code work good in my pc local but when i upload the web site the code not work and show me that error
the error is :
Could not find file 'C:\Documents and Settings\XPPRESP3\Desktop\New Folder (2)\test.zip'
private void Upload(string filename)
{
FileInfo fileInf = new FileInfo(filename);
string uri = "ftp://"+ftpServerIP+"/wwwroot/Program/"+ fileInf.Name;
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://"+ftpServerIP+"/wwwroot/Program/"+ fileInf.Name));
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary = true;
reqFTP.ContentLength = fileInf.Length;
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;
FileStream fs = fileInf.OpenRead();
try
{
Stream strm = reqFTP.GetRequestStream();
contentLen = fs.Read(buff, 0, buffLength);
while (contentLen != 0)
{
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
}
strm.Close();
fs.Close();
}
catch (Exception ex)
{
}
}
and recive it in button by :
Upload(FileUpload1.PostedFile.FileName);
any one can help me in this please