EXTJS&;PHP上传文件2
我在EXTJS()中使用了UploadFile示例,但有一个错误 ExtJS:EXTJS&;PHP上传文件2,extjs,Extjs,我在EXTJS()中使用了UploadFile示例,但有一个错误 ExtJS: var loadfile = new Ext.FormPanel({ fileUpload: true, width: 500, frame: true, title: 'Добавить фотографию', autoHeight: true, bodyStyle: 'padding: 10px 10px 0 10px;', labelWidth: 50
var loadfile = new Ext.FormPanel({
fileUpload: true,
width: 500,
frame: true,
title: 'Добавить фотографию',
autoHeight: true,
bodyStyle: 'padding: 10px 10px 0 10px;',
labelWidth: 50,
defaults: {
anchor: '95%',
allowBlank: false,
msgTarget: 'side'
},
items: [
{
xtype: 'fileuploadfield',
id: 'form-file',
emptyText: 'Выберите фотографию',
fieldLabel: 'Фото',
name: 'userfile',
buttonText: 'Открыть'
}],
buttons: [{
text: 'Сохранить',
handler: function(){
if(loadfile.getForm().isValid()){
//alert('Имя: '+loadfile.getForm().findField('userfile').getValue());
loadfile.getForm().submit({
url: '/test/file-upload.php',
waitMsg: 'Сохранение фотографии...',
success: function(loadfile, o){
msg('Success', 'Processed file "'+o.result.file+'" on the server');
}
});
}
}
},{
text: 'Сброс',
handler: function(){
loadfile.getForm().reset();
}
}]
});
file-upload.php:
$uploaddir = '/var/lib/tomcat6/webapps/test/upload/000'//.$_GET["path"];
if (!is_dir($uploaddir))
{
mkdir($uploaddir, 0777);
}
$uploaddir.='/';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir .
$_FILES['userfile']['name'])) {
echo $uploaddir;
} else {
echo "error";
}
我在ext-all.js中有错误:
未捕获的语法错误:意外标记
未捕获的语法错误:意外标记
未捕获的语法错误:意外标记我资助了此项:“?php$uploaddir='/var/lib/tomcat6/webapps/test/upload/'/.$\u GET[“path”];….}?”看起来您的服务器没有处理php,只是将其作为纯文本返回。你确定apache中启用了mod_php吗?apache是的,但是这个html从tomcat6i开始:“php$uploaddir='/var/lib/tomcat6/webapps/test/upload/'/.$\u GET[“path”];…..}?”看起来你的服务器没有处理php,只是以纯文本的形式返回它。你确定apache中启用了mod_php吗?apache是的,但是这个html是从tomcat6开始的