PDA

View Full Version : ????????????????????????



kuro
13 Jul 2010, 10:12 AM
Example?http://www.sencha.com/deploy/dev/examples/form/file-upload.html??
?????????????????????????????????
??????????????success?failure?????????????result????????
??????????????????
????????????????????????????



<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>File Upload</title>
<link rel="stylesheet" type="text/css" href="http://www.sencha.com/deploy/dev/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="http://www.sencha.com/deploy/dev/examples/shared/examples.css" />
<link rel="stylesheet" type="text/css" href="http://www.sencha.com/deploy/dev/examples/ux/fileuploadfield/css/fileuploadfield.css"/>
<script type="text/javascript" src="http://www.sencha.com/deploy/dev/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="http://www.sencha.com/deploy/dev/ext-all.js"> </script>
<script type="text/javascript" src="http://www.sencha.com/deploy/dev/examples/ux/fileuploadfield/FileUploadField.js"> </script>
<style type="text/css">
.upload-icon {
background: url('http://www.sencha.com/deploy/dev/examples/shared/icons/fam/image_add.png') no-repeat 0 0 !important;
}
</style>
<script type="text/javascript">

Ext.onReady(function () {

// ????
var fp = new Ext.FormPanel({
renderTo: 'form1',
fileUpload: true,
width: 300,
frame: true,
title: 'File Upload Form',
bodyStyle: 'padding: 10px 10px 0 10px;',
items: [{
xtype: 'fileuploadfield',
fieldLabel: 'File',
name: 'fName',
buttonText: '',
buttonCfg: { iconCls: 'upload-icon' },
listeners: {
'fileselected': function (btn, v) {
execUpload(btn, v);
}
}
}, {
xtype: 'displayfield',
id: 'dsp',
value: ''
}
]
});

// ??????
var execUpload = function (btn, v) {
Ext.getCmp('dsp').setValue('???????...');
fp.getForm().submit({
url: 'http://www.sencha.com/deploy/dev/examples/form/file-upload.php',
method: 'POST',
success: function (f, action) {
Ext.getCmp('dsp').setValue('?????????????');
var ans = action.result.success; // ???????????
}
});
};

});
</script>
</head>
<body>
<div id="form1"></div>
</body>
</html>

yuki
22 Jul 2010, 4:56 AM
???????????????????XmlHttpRequest???????????????????????responseText?responseXML????????

???????????????????responseText?responseXML??????result????????????????????????????????????(Ext.form.Action.processResponse??????

kuro
22 Jul 2010, 6:47 AM
???????????????

????????????????????????????????????????
???????????????