Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bootstrap4 fileinput bug
#6
Code:
procedure TAppUpload.IWBS4File1CustomRestEvents0RestEvent(
  aApplication: TIWApplication; aRequest: THttpRequest; aReply: THttpReply;
  aParams: TStrings);
var i: integer; AStream: TMemoryStream;
begin

for i := 0 to aRequest.Files.Count-1 do
begin

// THttpFile(aRequest.Files[i]).SaveToFile(ExtractFilePath(ParamStr(0))+'Data\'+aRequest.Files[i].FileName, True);
  AStream := TMemoryStream.Create;
  try
   THttpFile(aRequest.Files[i]).SaveToStream(AStream);
   AStream.Position := 0;
   AStream.SaveToFile(ExtractFilePath(ParamStr(0))+'Data\'+aRequest.Files[i].FileName); // Correct FileName can only be read manually from the stream
   (...)

  finally
   AStream.Free;
  end;

end;
aReply.WriteString('{"id": "1"}');
end;


You get all files when you set IWBS4File1 > CustomRestEvents > uploadUrl > ParseFileUpload to False

Stream looks like this:

------WebKitFormBoundaryQm9CpCSSrHXo0r3p
Content-Disposition: form-data; name="IWBS4FILE1[]"; filename="TestFile.png"
Content-Type: image/png

‰PNG
(...)
------WebKitFormBoundaryQm9CpCSSrHXo0r3p
Content-Disposition: form-data; name="file_id"

2
------WebKitFormBoundaryQm9CpCSSrHXo0r3p--
Reply


Messages In This Thread
Bootstrap4 fileinput bug - by Rassamaha78 - 04-18-2020, 08:26 PM
RE: Bootstrap4 fileinput bug - by Rassamaha78 - 04-19-2020, 02:39 PM
RE: Bootstrap4 fileinput bug - by TPiotr - 04-19-2020, 09:21 PM
RE: Bootstrap4 fileinput bug - by Rassamaha78 - 04-20-2020, 08:36 AM
RE: Bootstrap4 fileinput bug - by Rassamaha78 - 04-19-2020, 09:28 PM
RE: Bootstrap4 fileinput bug - by TPiotr - 04-20-2020, 10:19 AM
RE: Bootstrap4 fileinput bug - by Rassamaha78 - 04-20-2020, 10:45 AM
RE: Bootstrap4 fileinput bug - by TPiotr - 04-20-2020, 10:58 AM
RE: Bootstrap4 fileinput bug - by Rassamaha78 - 04-20-2020, 11:04 AM
RE: Bootstrap4 fileinput bug - by TPiotr - 04-20-2020, 11:06 AM
RE: Bootstrap4 fileinput bug - by Rassamaha78 - 04-20-2020, 11:14 AM
RE: Bootstrap4 fileinput bug - by TPiotr - 04-20-2020, 01:33 PM
RE: Bootstrap4 fileinput bug - by Rassamaha78 - 04-20-2020, 03:56 PM
RE: Bootstrap4 fileinput bug - by Rassamaha78 - 04-29-2020, 08:24 PM
RE: Bootstrap4 fileinput bug - by TPiotr - 05-01-2020, 04:18 PM
RE: Bootstrap4 fileinput bug - by TPiotr - 05-01-2020, 11:43 PM
RE: Bootstrap4 fileinput bug - by Rassamaha78 - 05-03-2020, 03:34 PM
RE: Bootstrap4 fileinput bug - by TPiotr - 05-03-2020, 02:47 PM
RE: Bootstrap4 fileinput bug - by TPiotr - 05-09-2020, 05:34 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)