I took your advice and used FTP however i have an issue.
The files are transferred successfully if i run my application from my system. when the application is placed in IIS7 it transfers the files however the files arrive on the server empty.
i am attaching the code that actually does the upload from a local user system to the file server.
/* Upload File */
public bool upload(string remoteFile, string localFile)
{
bool statval = true;
try
{
/* Create an FTP Request
*/
FtpWebRequest ftpRequest = (FtpWebRequest)FtpWebRequest.Create(remoteFile);
ftpRequest.UseBinary = true;
/* Log in to the FTP Server with the User Name and Password Provided */
ftpRequest.Credentials = new NetworkCredential(_username, _password);
/* When in doubt, use these options */
ftpRequest.UseBinary = true;
//ftpRequest.Proxy = null;
//ftpRequest.UsePassive = true;
//ftpRequest.KeepAlive = true;
/* Specify the Type of FTP Request */
ftpRequest.Method = WebRequestMethods.Ftp.UploadFile;
/* Establish Return Communication with the FTP Server */
Stream ftpStream = ftpRequest.GetRequestStream();
/* Open a File Stream to Read the File for Upload */
FileStream localFileStream = new FileStream(localFile, FileMode.Open);
/* Buffer for the Downloaded Data */
byte[] byteBuffer = new byte[bufferSize];
int bytesSent = localFileStream.Read(byteBuffer, 0, bufferSize);
/* Upload the File by Sending the Buffered Data Until the Transfer is Complete */
try
{
while (bytesSent != 0)
{
ftpStream.Write(byteBuffer, 0, bytesSent);
bytesSent = localFileStream.Read(byteBuffer, 0, bufferSize);
}
}
catch (Exception ex)
{
// Console.WriteLine(ex.ToString());
statval = false;
}
/* Resource Cleanup */
localFileStream.Close();
ftpStream.Close();
ftpRequest = null;
}
catch (Exception ex)
{
//Console.WriteLine(ex.ToString());
statval = false;
}
return statval;
}