1
我想aplly在ExtJS的上传文件如本例:文件上传ExtJS的
myuploadform= new Ext.FormPanel({
fileUpload: true,
width: 500,
autoHeight: true,
bodyStyle: 'padding: 10px 10px 10px 10px;',
labelWidth: 50,
defaults: {
anchor: '95%',
allowBlank: false,
msgTarget: 'side'
},
items:[
{
xtype: 'fileuploadfield',
id: 'filedata',
emptyText: 'Select a document to upload...',
fieldLabel: 'File',
buttonText: 'Browse'
}],
buttons: [{
text: 'Upload',
handler: function(){
if(myuploadform.getForm().isValid()){
form_action=1;
myuploadform.getForm().submit({
url: 'handleupload.php',
waitMsg: 'Uploading file...',
success: function(form,action){
msg('Success', 'Processed file on the server');
}
});
}
}
}]
})
当我运行它,我看到它试图要上传的文件并没有什么happends(它永远不会完成);
现在我明白handleupload.php应该处理上传的文件。
我已经tryed aplying它在这个eaxmple:file upload using EXT JS
,但我似乎无法使其工作,应该是究竟是什么在PHP文件?
TY。
找不到php部分。这是我唯一缺少的部分,你可以请复制PHP服务器端的代码 – susparsy
它被称为'file-upload.php'。 –
我创建了从示例代码中的handleupload.php,并在控制台中我得到:“未捕获Ext.JSON.decode():你试图解码的JSON字符串无效:......” – susparsy