I was hoping that someone could shed some light as to why this is happening. Here is the relivent code:
Code: Select all
//the code that calls everything
Connect(Engine.Model.FTPHost, Engine.Model.FTPPort);
Login(Engine.Model.FTPUser, Engine.Model.FTPPass);
ChangeDirectory(Engine.Model.UploadDirectory);
SetDataType("I");
Upload(Engine.Model.Que[i], Engine.Model.Que[i].getName());
Disconnect();
//end
//the Upload method
private synchronized boolean Upload(File TheFile, String FileName) throws IOException
{
DataSocket = GetPassiveDataSocket();
SendCommand("STOR " + FileName + "\r\n");
String Response = GetResponse();
if (!Response.startsWith("150") && !Response.startsWith("125"))
{
return false;
}
BufferedInputStream BufferedInput = new BufferedInputStream(new FileInputStream(TheFile));
BufferedOutputStream BufferedOutput = DataSocket.GetOutputStream();
float FileSize = TheFile.length();
float PercentPerIteration = 100 / FileSize;
int BytesRead = 0;
int BufferSize = 1024;
byte[] Buffer = new byte[BufferSize];
int CurrentByte;
while (((CurrentByte = BufferedInput.read(Buffer)) != -1) && Engine.Model.AllowToRun)
{
BytesRead = BytesRead + BufferSize;
float Percent = PercentPerIteration * BytesRead;
Engine.View.SetProgressBarValue((int)Percent);
BufferedOutput.write(Buffer, 0, CurrentByte);
}
BufferedInput.close();
BufferedOutput.close();
return true;
}