0
如何上傳圖像和圖像轉換成的base64字符串,這裏一些代碼,使聽衆對ExtJS的:圖片上傳到Base64編碼的ExtJS的4
xtype: 'filefield',
id: 'image',
emptyText: '-- Choose Image --',
fieldLabel: 'Photo',
name: 'image',
anchor: "82%",
buttonText: 'Browse',
buttonConfig: {
iconCls: ''
},
change: function() {
// this is get component
var valueElement = Ext.getCmp("component_image_upload").getValue();
// function upload image full path and encode to base64
// function here
// result to encode base64
var GenEncoded = valueElement;
Ext.getCmp("component_textarea").setValue(GenEncoded);
我嘗試添加BTOA功能,但它只是轉換在FileField或不上傳圖像串:
// result to encode base64
var GenEncoded = btoa(valueElement);
Ext.getCmp("ttransdelivery_module_manualreceive_form_receive_ar_1_general_blk_i_form_text_2031").setValue(GenEncoded);
謝謝