There are four problems with your code:
Your loop counter is wrong. You need to use
Length(arquivos)-1
(orPred(Length(arquivos))
, orHigh(arquivos)
) instead.You are calling
Post()
inside the loop, but it needs to be outside the loop instead.You are specifying the wrong content type for each file.
You are destroying the stream on each loop iteration.
Try this instead:
POSTData := TIdMultipartFormDataStream.Create;
try
for i := Low(arquivos) to High(arquivos) do
begin
if FileExists(arquivos[i]) then
begin
//AddFile() will choose the content type for you based on the file extension
POSTData.AddFile('files[]', arquivos[i]);
end;
end;
HTTP.Post('http://localhost/ENVIO/MultUp.php', POSTData);
finally
POSTData.Free;
end;