[英]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.