简体   繁体   English

将src数据:图像信息另存为文件

[英]Save src data:image information as file

I am using classic asp and I have created a preview script in jQuery. 我正在使用经典的ASP,并且已经在jQuery中创建了预览脚本。

$('#file').change(function(){ 
    var oFReader = new FileReader(); 
    oFReader.readAsDataURL(this.files[0]);
    oFReader.onLoad = function (oFREvent) {
       $('#preview').html('<img id="trial" src="' + oFReader.target.result + '">');
       };
});

This works add provides a preview of the image inside of the div called #preview. 该作品的添加为div内#preview的图像提供了预览。

What I now need to do is physically save the file into a directory on the website? 我现在需要做的是将文件实际保存到网站上的目录中?

The resultant img tag has the following src value: 生成的img标签具有以下src值:

 src = 'data:image/PNG; base64,XXXXXXXXX'

Where XXXXXXXXX is a base 64 encode string and PNG is just the file type (can also be JPG, GIF, etc) 其中XXXXXXXXX是基数为64的编码字符串,而PNG只是文件类型(也可以是JPG,GIF等)

似乎没有一种轻松实现此目的的方法,因此我创建了一个.Net DLL为我完成这项工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM