Hi, I'm trying to translate this PHP code to fcl-web (actually brookframework):

<?php
$content = file_get_contents('php://input');
$fh = fopen('output.wav', 'w') or die("can't open file");
fwrite($fh, $content);
fclose($fh);
?>

The difficult part is the line with "file_get_contents('php://input')", it contains the whole POST content as binary.

What I already did was this:

procedure TActAudio.Post;
var
  lWav: TMemoryStream;
begin
  lWav := TMemoryStream.Create;
  try
    lWav.Write(HttpRequest.Content[1], HttpRequest.ContentLength);
    lWav.Position:= 0;
    lWav.SaveToFile('/tmp/output.wav');
  finally
    lWav.Free;
  end;
end;

But the output.wav result is corrupt, while the php one is correct.

Any hint?.

Regards,
--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to