struts2+ext3的UploadDialog上传时总是为tmp后缀名,这是什么原因呢
ext吧
全部回复
仅看楼主
level 1
toemacro 楼主
大家好,如题!
文件可以上传,但不管上传什么文件,文件名都为:
upload__24545a03_12c9cafad2d__7ffe_00000004.tmp
或类型的为tmp的文件。路径和文件名都变了。
这个跟struts的上传过滤器有关系吗?
我找了很多都说要在struts.property中加struts.multipart.saveDir=\temp
但是加了也没用
我的ext为3.x版权,UploadDialog也是支持ext3.x的版权。
前台代码:
var dialog = new Ext.ux.UploadDialog.Dialog({
     width: 450,
     height: 300,
     title: '上传附件',
     [url='gm/gmActualOwnerAction_applyUpload.action]url:'gm/gmActualOwnerAction_applyUpload.action'[/url],
     base_params:'',
     reset_on_hide: false,
     allow_close_on_upload: true
});
//文件上传成功后的回调函数  
var onUploadSuccess = function(dialog, filename, resp_data, record){
   Ext.MessageBox.alert('提示','上传成功!');
};
var addFileButton = new Ext.Button({
     text :'上传附件',
     align :'center',
     handler : function() {
       dialog.show();  
       dialog.on('uploadsuccess', onUploadSuccess);
}
});
后台代码:
private File[] files;
public File[] getFiles() {
   return files;
}
public void setFiles(File[] files) {
   this.files = files;
}
String[] fileName = new String[files.length];
     for(int i=0;i<files.length;i++){
//     File f = files;
//     files.getName();
     fileName = files.getName();
     CommonTools.info("fileName ===============================" + fileName);
     CommonTools.info("getAbsolutePath ====================" + files.getAbsolutePath());
     CommonTools.info("getPath ====================" + files.getPath());
     CommonTools.info("getParentFile ====================" + files.getParentFile());
     }
后台输出:
fileName ===============================upload__24545a03_12c9cafad2d__7ffe_00000004.tmp
2010-11-30 20:26:02,954 [http-8080-8] INFO   root - getAbsolutePath ====================F:\Bankht\eclipse\emp\upload__24545a03_12c9cafad2d__7ffe_00000004.tmp
2010-11-30 20:26:02,954 [http-8080-8] INFO   root - getPath ====================emp\upload__24545a03_12c9cafad2d__7ffe_00000004.tmp
2010-11-30 20:26:02,954 [http-8080-8] INFO   root - getParentFile ====================emp
2010-11-30 20:26:02,964 [http-8080-8] INFO   root - ---------------fileutils:c:/gmis/uploadfiles/
各位高手请帮忙了!!!非常感谢!!!!!
来源:一起Ext
原文地址:http://www.17ext.com/showtopic-37685.aspx
2010年11月30日 12点11分 1
level 1
好像UploadDialog和Ext3不兼容
2011年05月11日 09点05分 2
1