[英]Save an image inside a directory Extjs
我有用于预览图像的以下代码:
{
xtype: 'filefield',
x: 120,
y: 130,
width: 490,
//buttonOnly: true,
name: 'rutas',
itemId: 'rutas',
labelWidth: 90,
fieldLabel: 'Buscar Foto',
listeners: {
'change': function (newVal) {
var file = newVal.fileInputEl.el.dom.files[0];
var reader = new FileReader();
console.log(reader);
reader.readAsDataURL(file);
reader.onload = function (evt) {
var image = Ext.ComponentQuery.query("[itemId=imageid]")[0];
image.setSrc(evt.target.result);
}
}
},
},
然后设置显示图像的位置:
{
xtype: 'image',
x: 20,
y: 5,
itemId: 'imageid',
style: "border: 1px solid black",
minHeight: 90,
width: 65,
height: 'auto',
//html:'<div align="center" style="background-color:white;" ><img src="http://src.sencha.io/http://yoursite.com/splash.png" ></div>',
src: 'tmp/default.png'
},
这些代码工作正常,但是我需要将所选图像保存到我的应用程序的目录中。 有人知道该怎么做吗?
我读过一本书,说可以使用setSrc将文件移动到目录中,但是我真的不知道该怎么做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.