简体   繁体   English

将图像保存在目录Extjs中

[英]Save an image inside a directory Extjs

I have this code for previewing images: 我有用于预览图像的以下代码:

{                           
  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);                                                                            
      }
    }
  },                     
},

and I set a place where the image is being display: 然后设置显示图像的位置:

{
  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'                            
},

These code is working fine but I need to save the selected image into a directory in my app. 这些代码工作正常,但是我需要将所选图像保存到我的应用程序的目录中。 Someone knows how to do it ? 有人知道该怎么做吗?

I have read a book which says that with setSrc you can move files into directories but I don´t really have any clue about how to do it. 我读过一本书,说可以使用setSrc将文件移动到目录中,但是我真的不知道该怎么做。

Please have a look of fiddle url given below:- 请看下面的小提琴网址:

https://fiddle.sencha.com/#view/editor&fiddle/2f70 https://fiddle.sencha.com/#view/editor&fiddle/2f70

Currently I am not sure about how we can set location (where to download). 目前,我不确定如何设置位置(下载位置)。

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

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