Follow the previous question:
Previous question on the same subject.
Now what it is showing is:
link
Code used:
Functional in VCL:
function TForm1.UploadArquivo(server, script, caminhoarq : string) : boolean;
var
Response, UploadURL : String;
HTTPClient : TIdHTTP;
Lista : TIdMultiPartFormDataStream;
begin
result := False;
UploadURL := server + script;
HTTPClient := TIdHTTP.Create;
Lista := TIdMultiPartFormDataStream.Create;
HTTPClient.ReadTimeout := 10000;
HTTPClient.ProtocolVersion := pv1_1;
HTTPClient.Request.ContentType := 'utf-8';
HTTPClient.Request.UserAgent := 'Mozilla/3.0 (compatible;Indy Library)';
HTTPClient.HTTPOptions := [hoForceEncodeParams,hoKeepOrigProtocol];
Response := '';
try
try
//Lista.Add('Arquivo='+ caminhoarq);
Lista.AddFile('Arquivo', caminhoarq, 'application/octet-stream');
Response := UTF8Decode(Trim(HTTPClient.Post(UploadURL, Lista)));
//Label1.Text := Response;
if Response = 'OK' then
Result := true;
except
on e : exception do ShowMessage('Erro ao enviar arquivo ao servidor! Detalhes: '+e.Message);
end;
finally
Lista.Free;
HTTPClient.free;
end;
end;
However, the site exists, and I have checked the string several times, and even then, it is displaying this message.
Now I'm testing firemonkey, the same code, because I believe it has not changed much, or even nothing.
Does anyone have an idea what's going on?
------------------ EDIT -----------------------
According to the debugs I've been doing, follow the comments:
In this line, the code for:
Response := UTF8Decode(Trim(HTTPClient.Post(UploadURL, Lista)));
Then I went deeper. In the function DoRequest
.
When trying to connect to the Host, in the CheckAndConnect
function, which is located inside the ConnectToHost
function, it returns the error 404 located in Response
.
But when I try to perform the same procedure on a VCL form. It works perfectly.