cross socket multipart/form-data
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;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/12572729.html