Send File. Help. #116
Unanswered
PedroAlbuquerqueQueiroz
asked this question in
Q&A
Replies: 1 comment
-
Bom dia, se olhar no exemplo tem: Vale dar uma olhada também nesse pull request: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Vinicius, tudo bem ?
Por favor, com vejo que você tem um vasto conhecimento com restrequest, poderia me ajudar com a situação abaixo ?
-> Preciso enviar um arquivo em uma requisição post, porem o arquivo deve seguir no body em form-data:
file
foto: https://www.jasaquei.com.br/docs/print_postman.png
Tentativas
Não deu certo..


LResponse := TRequest.New.BaseURL('Url')
.AddHeader('Authorization','Bearer '+xTokenIntegracao,[poDoNotEncode])
.AddParam('dataPagamento',formatdatetime('YYYY-MM-DD',Now),pkREQUESTBODY)
.AddParam('codigoAutenticacao',DataSource1.DataSet.FieldByName('CWB_AUTENTICACAO_PAGTO').AsString,pkREQUESTBO
DY)
.AddParam('observacoes','Pagto Liquidado. '+formatdatetime('DD/MM/YY hh:mm',Now),pkREQUESTBODY)
.AddFile(DataSource1.DataSet.FieldByName('CWB_ID').AsString+'.pdf',xStream)
.Accept('application/json')
.Post;
Não Deu certo (2)
LRequest := THTTPClient.Create;
// LFormData := TMultipartFormData.Create();
// LResponseStringStream := TStringStream.Create;
// try
// LFormData.AddField('Authorization','Bearer '+xTokenIntegracao);
// LFormData.AddField('body',xBody);
// LFormData.AddFile('arquivo','C:\comprovantes'+DataSource1.DataSet.FieldByName('CWB_ID').AsString+'.pdf');
// LRequest.Post('Url', LFormData, LResponseStringStream);
// finally
// LFormData.Free;
// LResponseStringStream.Free;
// LRequest.Free;
// end;
Não Deu certo (3)
RESTClient1.BaseURL := 'URL/'+FDMemTblIdLicenca.FieldByName('ID_LICENCIAMENTO').AsString;
RESTClient1.ContentType := 'multipart/form-data';
RESTClient1.Accept := 'multipart/form-data';
Muito agradecido se poder ajudar.
Beta Was this translation helpful? Give feedback.
All reactions