Home > Back-end >  TidHttpServer receive binary file should be how to parse?
TidHttpServer receive binary file should be how to parse?

Time:09-15

With indy10 TidHttpServer control homemade web file server, you can download it cannot upload function, after receiving the data will not be parsed, please which suggest a thing or two, thank you very much!!!!!

Source:
Var
Mm: an array of Byte;
K: Integer;
.
The begin
.
If ARequestInfo. PostStream=nil then begin
AResponseInfo. ContentText:=UTF8Encode (' failed to upload file! ');
AResponseInfo. ContentType:='text/HTML;
AResponseInfo. ContentEncoding:="utf-8";
AResponseInfo. CharSet:="utf-8";
End the else begin
ARequestInfo. PostStream. Position:=0;
//to judge the different of text and binary format? No idea, temporary pretending to be a binary first
Setlength (mm, ARequestInfo. PostStream. Size + 4);
K:=ARequestInfo. PostStream. ReadData (mm, ARequestInfo. PostStream. Size);
//???????????????????????????????????????????????????????????????
//the size have read mm in length content is all the code and don't know how to handle!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//please everyone...
The end...
The end;


Web client HTML upload statements:

CodePudding user response:

The form post must be specified address, is this your/upload. Asp
The service side. As long as the judge ARequestInfo URI is to accept the file URI, can directly ARequestInfo. PostStream. SaveToFile
  • Related