PDA

View Full Version : FileUploadField and Opera problem.



Selvatico
9 Jul 2009, 11:51 PM
Sorry for my English. Can somebody help me? I download ExtJs 3.0 with example. And i tryuing to make it for? but if use firefox, IE, chrome - there no problem. But if using Opera, it don't want download file. My code:


Ext.onReady(function(){

Ext.QuickTips.init();

var msg = function(title, msg){
Ext.Msg.show({
title: title,
msg: msg,
minWidth: 200,
modal: true,
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
};

var fibasic = new Ext.ux.form.FileUploadField({
renderTo: 'fi-basic',
width: 400
});

var fp = new Ext.FormPanel({
renderTo: 'fi-form',
fileUpload: true,
width: 500,
frame: true,
title: 'File Upload Form',
autoHeight: true,
bodyStyle: 'padding: 10px 10px 0 10px;',
labelWidth: 50,
defaults: {
anchor: '95%',
allowBlank: false,
msgTarget: 'side'
},
items: [{
xtype: 'textfield',
fieldLabel: 'Name'
},{
xtype: 'fileuploadfield',
id: 'form-file',
emptyText: 'Select an image',
fieldLabel: 'Photo',
name: 'photo-path',
buttonText: '',
buttonCfg: {
iconCls: 'upload-icon'
}
}],
buttons: [{
text: 'Save',
handler: function(){
if(fp.getForm().isValid()){
fp.getForm().submit({
url: 'file-upload.php',
waitMsg: 'Uploading your photo...',
success: function(fp, o){
msg('Success', 'Processed file "'+o.result.file+'" on the server');
}
});
}
}
},{
text: 'Reset',
handler: function(){
fp.getForm().reset();
}
}]
});

});
PHP code:


<?php


$target_path = $_SERVER['DOCUMENT_ROOT']."/". basename( $_FILES['photo-path']['name']);
if(@move_uploaded_file($_FILES['photo-path']['tmp_name'], $target_path))
{
sleep(1);
echo '{success:true, file:'.json_encode($_FILES['photo-path']['name']).'}';
}Can somebody help?