Is this a web server on an Indy Problem?

Giganews Newsgroups
Subject: Is this a web server on an Indy Problem?
Posted by:  Harmon Distig (…@none.com)
Date: Sun, 06 Mar 2005

I have posted in winsock, but this may be a better place

Delphi 7 with Indy 9
Here is my issue:

I am trying to upload a list of .rec files to an intranet webserver so
other people on the intranet can pull them down by clicking a link. For
the curious, they are text logs for an insurance claims processing
department. All of the files are 70 to 100 kb, but when dozens or
sometimes hundreds are uploaded together, they total much more than that
-- maybe 20 MB. The bulk upload works fine as long as the total isn't
under 8MB, which is the maximum upload for this server. It generates
errors in the apache log any time the total is in excess of the 8MB
limit. Here's a sample log entry:

[Sun Mar 06 14:29:04 2005] [error] [client 192.168.18.11] Requested
content-length of 8114462 is larger than the configured limit of 8000000

Obviously, the admins won't let me change the web server file upload
limit, and that wouldn't fix my problem anyway. The web server could be
counting each one of these requests as a sepearate upload.

My feeling is that something is causing the web server to count all of
the uploaded files as a single instance of upload. The http posts are
being made seperately, I have verified this from the access log. How can
I make it so each file upload is treated as a seperate post? More to the
point, how can I break out of this loop and start a new session for each
one of these files? I have included my code. If anyone can tell me what
I should change, I would be grateful.

begin
AssignFile(completed_files, 'c:\temp\completed.rec');
Reset(completed_files);

// I loop through this list and upload each rec,
// one per line
while not Eof(completed_files) do
  begin
    ReadLn(completed_files, file1);
    path := 'c:\temp\';
    // the "test14" argument shows up in multiple requests in the log
    // so I don't understand why each one of these files counts toward
    // a single upload
    postto := 'http://192.168.18.5/upload.php?test14';
    stream := TIdMultiPartFormDataStream.Create;
      try
      stream.AddFile('userfile', path + file1, 'text/xml');
      IdHTTP1.Post(postto, stream);
      Sleep(1000);
      finally
      end;
stream.Free;

  end;

  CloseFile(completed_files);
    showmessage('finished');

end;

Replies