3
I can do an HTML post quietly, but when I try to do it with Delphi, it presents me with this mistake:
http/1.1 406 not acceptable
Follow the code below:
function TForm1.UploadArquivo(server, script, caminhoarq : string) : boolean;
var
Response : String;
HTTPClient : TIdHTTP;
Lista : TStringList;
begin
result := False;
HTTPClient := TidHTTP.Create;
HTTPClient.ProtocolVersion := pv1_0;
HTTPClient.Request.Accept := 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
HTTPClient.Request.UserAgent := 'Mozilla/3.0 (compatible; Indy Library)';
Response := '';
Lista := TStringList.Create;
try
try
Lista.Add('Arquivo='+ caminhoarq);
Response := Trim(HTTPClient.Post(server + script, Lista));
Label1.Caption := Response;
if Response = 'OK' then
Result := true;
finally
Lista.Free;
HTTPClient.free;
end;
except
on e:exception do ShowMessage('Erro ao enviar arquivo ao servidor! Detalhes: '+e.Message);
end;
end;
Use Delphi XE7, there is some particularity?
What am I doing wrong?
THANK YOU!! All right friend.
– Ramon Ruan