非常に単純なジョブを実行する非常に単純な PHP ファイルを作成しました。これは、Silverlight OutOfBrowser アプリケーションからサーバーに画像をストリーミングし、変数$_GET
と$_POST
変数を混合します。実際のところ、ここに私の非常に単純なコードがあります。セキュリティですが、ネットワーク経由でファイルを書き込めることを確認するためにとにかく書きました。複数のファイルがアップロードされた場合などで100%機能しました。
<?php
//Gets
$myFile = $_GET['FileName'] ? $_GET['FileName'] : "input_stream.txt";
$openedFile = fopen($myFile, 'w') or die("can't open file");
$input = file_get_contents("php://input");
fwrite($openedFile, $input);
fclose($openedFile);
//Check the mime type of the file (WRONG WAY)
$mimeType = mime_content_type($myFile);
$input = null;
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mimeType = finfo_file($finfo, $myFile);
echo $myFile . 'was uploaded, mime type : ' . $mimeType;
?>
生の POST データ (Silverlight の ByteArray) を取得する簡単な Ruby の代替手段はありますか?