Okay, so, I have a MVC app where I'm creating a canvas image, and getting the data url just by doing canvas.toDataURL("image/png"). What I'd like to do is save this to the user's file system.
var saveUrl = canvas.toDataURL("image/png");
saveUrl = saveUrl.replace("image/png", "application/octet");
But that just gives me a file named `download` without any extension or anything. I'd like to get the save dialog and give the file a type and name, and save that to the user's disc.
So I figured I could post the data to the server, and then do something with the response headers to tell the browser that I'm trying to save an image for it, but I can't find a good way to do this. I'm using ASP.NET MVC. Does anyone have a good easy way for me to do this?
以上就是Save canvas dataurl to user's file system的详细内容，更多请关注web前端其它相关文章！