per*_*zzo 10 c# asp.net asp.net-core
我正在尝试在ASP.NET Core中使用这个库:https://github.com/infusion/jQuery-webcam来获取从网络摄像头拍摄的照片.
在这个例子中,MVC Capture网络摄像头图像,将图像的文件路径保存到数据库,这是怎么回事:
$(document).ready(function () {
$("#Camera").webcam({
width: 320,
height: 240,
mode: "save",
swffile: "@Url.Content("~/Scripts/jscam.swf")",
onTick: function () { },
onSave: function () {
},
onCapture: function () {
webcam.save("@Url.Action("Capture", "TrapActivity", new { id = @Model.Id , pid = @Model.PersonId})");
},
debug: function () { },
onLoad: function () { }
});
});
Run Code Online (Sandbox Code Playgroud)
调用的Controller方法Capture从此行的View中调用:webcam.save("@Url.Action("Capture", "TrapActivity", new { id = @Model.Id , pid = @Model.PersonId})");
public ActionResult Capture(string ID)
{
var path = Server.MapPath("~/Images/ID_" + ID + ".jpg" );
//var path1 = "~/Images/test.jpg;";
var stream = Request.InputStream;
string dump;
using (var reader = new StreamReader(stream))
dump = reader.ReadToEnd();
if (System.IO.File.Exists(path))
{
System.IO.File.Delete(path);
System.IO.File.WriteAllBytes(path, String_To_Bytes2(dump));
}
else System.IO.File.WriteAllBytes(path, String_To_Bytes2(dump));
return View(ID);
}
Run Code Online (Sandbox Code Playgroud)
在里面,有一个var stream = Request.InputStream;.
问题是在ASP.NET Core中没有 Request.InputStream.
我可以用什么呢?有人可以帮忙吗?
| 归档时间: |
|
| 查看次数: |
4269 次 |
| 最近记录: |