cross socket multipart/form-data
uses Net.CrossHttpParams;
var parts: THttpMultiPartFormData := THttpMultiPartFormData(request.Body); var ms: TMemoryStream := TMemoryStream.Create; var path: string := UpPath; try ForceDirectories(path); // 上传路径 var filenum: integer := StrToInt(ParamValue(request.RawPathAndParams, 'filenum')); for var i: integer := 1 to filenum do begin ms.Size := parts.Fields['file' + i.ToString].Value.Size; ms.CopyFrom(parts.Fields['file' + i.ToString].Value, 0); var fname: string := path + ParamValue(request.RawPathAndParams, 'filename' + i.ToString); ms.SaveToFile(fname); // 保存上传的文件 ms.Clear; end; finally ms.Free; end;