私はいくつかの答えを見つけました(たとえばここに)が、それらは私の問題を解決していないようです。
var result = {
command: 'exportWAV',
type: type
};
$.ajax({
url: 'SubmitSound',
type: 'Post',
data: JSON.stringify(result),
contentType: 'application/json; charset=utf-8',
success: function (msg) {
alert(msg);
}
});
バックエンド コード
[HttpPost]
public ActionResult SubmitSound(string blob)
{
// Create the new, empty data file.
string fileName = AppDomain.CurrentDomain.BaseDirectory + "/Content/Sound/" + Environment.TickCount + ".wav";
FileStream fs = new FileStream(fileName, FileMode.CreateNew);
BinaryWriter w = new BinaryWriter(fs);
w.Write(blob);
w.Close();
fs.Close();
return new JsonResult() { Data = "Saved successfully" };
}
result
this.postMessage = result;
ダウンロードのためにファイルをクライアント側に送り返すため、null ではありません。できないとw.Write(blob)
不平を言い続けます。blob
null
どうすればそれを機能させることができますか?ありがとう、そしてよろしく