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