<?php
if(!isset($_REQUEST['filename']))
{
exit('No file');
}
$upload_path = dirname("files"). '/';
$filename = $_REQUEST['filename'];
$fp = fopen($upload_path."/".$filename.".wav", "wb");
***fwrite($fp, file_get_contents('php://input'));***
fclose($fp);
exit('done');
?>
I am using this example try to record audio and send it to the server. With PHP it works fine, but I want convert this code into Ruby. In this line there is (php://input), what is that mean? And what should I write same in ruby
fwrite($fp, file_get_contents(‘php://input’));
Thanks
Obviously ruby does not have the
php://stream wrapper – it’s PHP specific. So you can not port it literally.php://inputis explained here: http://php.net/manual/en/wrappers.php.phpSo for example, if that is a post request (which is normally the case), for Rails 3, the
request.raw_postdocumentation is at http://api.rubyonrails.org/classes/ActionDispatch/Request.html#method-i-raw_post .