我有一个.js文件,您可以在其中上传文件或多个文件。我还需要能够在上传文件后删除它。我对这段代码还不太熟悉。
这是上传的代码:
onChooseStepImageClicked: function(btn, e){
var form = btn.up('form'),
grid = this.getGridProcess(),
selectedRecord = grid.getSelectionModel().getLastSelected(),
processid = selectedRecord.get('processid'),
win = Ext.create('Ext.window.Window',{
title:'Image',
modal:true, constrain:true, stateful:true,
width:600, height:400,
layout:'fit',
items:[
{
border:false,
xtype:'plupload',
_url : 'data/upload.processimagemap.php',
_resize : {width : 600, height : 600, quality : 90},
_unique_names : false,
_multi_selection : false,
_filters : [{title : "Image files", extensions : "jpg,jpeg,gif,png"}]
}
],
buttons:[
{text:'Upload', handler:function(btn){
var win = btn.up('window'),
uploader = win.down('plupload').uploader;
if (uploader.files && uploader.files.length > 0) {
uploader.settings.multipart_params = {processid:processid};
uploader.processid = processid;
uploader.form = form;
uploader.win = win;
uploader.bind('UploadComplete', function(up, files) {
up.form.doLoad(processid);
uploader.destroy();
up.win.close();
});
uploader.start();
}else{
Ext.Msg.alert('','Please select a file to upload.');
}
}},
{text:'Close', handler:function(){ win.close(); }}
],
listeners:{
beforeclose:function(win){
win.down('plupload').uploader.destroy();
}
}
});
win.show();
},
{
title:'Image',
layout: 'fit',
border: false,
items: {
disabled: (canEditProcess) ? false : true,
xtype:'form',
formId:'form_step_image',
tbar:[{iconCls:'image_add', text:'Choose Image', name:'choose_step_image'}, {iconCls:'image_add', text:'Remove Image', name:'remove_step_image'}],
border:false,
autoScroll:true,
bodyPadding:20,
items:[{xtype:'image', src:'', name:'step_image'}],
doLoad:function(processid){
var f = this, formImg = f.down('image');
f.getForm().load({
url:'data/load.processimage.php',
params:{processid: processid},
success:function(f,a){
var data = Ext.JSON.decode(a.response.responseText);
formImg.setSrc(data.data.image);
}
});
}
}
},
并且:
'button[name=choose_step_image]': {
click: this.onChooseStepImageClicked
},
'button[name=remove_step_image]': {
click: this.onRemoveStepImageClicked
},
如何删除刚刚上传的文件? 我对js还不太熟悉,这有点高级:) 感谢