首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Extjs fileupload - fileitem.getName()为空

Extjs fileupload - fileitem.getName()为空
EN

Stack Overflow用户
提问于 2015-01-28 12:54:14
回答 1查看 182关注 0票数 0

以下是上传文件的代码:

extjs

代码语言:javascript
复制
 buttons: [
 {
     buttonAlign: 'left',
     margin:'1 1 4 300',
     text: 'Upload',
     iconCls: 'upload_button',
     width: '30',
     handler : function() {
         if(validateFile()){
        if (loanWiseStockInfopannel.getForm().isValid()) {
     alert('asdf3'+loanWiseStockInfopannel.getForm().submit());
            loanWiseStockInfopannel.getForm().submit({
                url: 'LoanWiseExcelUpload',                 
                method:'POST',
                success: function(response, opts){
                     msgs = 'File Uploaded Successfully';
                     successFunction(msgs);
                     xl_Reading();
                  },failure: function(response, opts) {
                     msgs = 'File Uploaded Failed'; 
                     successFunction(msgs);
                  }
             })
           }
        }



    } 
}]

java文件

代码语言:javascript
复制
        DiskFileUpload diskfileupload = new DiskFileUpload();
        long maxfilesize =1*1024*1024;//1MB         
        System.out.println("Max File size allowed is (in bytes) :: "+maxfilesize);
        diskfileupload.setSizeMax(maxfilesize);
        diskfileupload.setSizeThreshold(4096);

        System.out.println("===> Uploading the file to :: "+FilePaths.UPLD_DEST_DIR_PATH);
        diskfileupload.setRepositoryPath(FilePaths.UPLD_DEST_DIR_PATH);

        List list = diskfileupload.parseRequest(request);
        for(Iterator iterator = list.iterator(); iterator.hasNext();){
            fileitem = (FileItem)iterator.next();
            if(!fileitem.isFormField()){
                if(fileitem.getSize() < 1){
                    //Added by Sowbakia for AppSecIssues-ContentValidation
                    errorflag   = true;
                    errorMsg    = "Not a valid Excel file"; 
                    //Add End
                }
                //throw new Exception("No file was uplaoded");
                String s = fileitem.getName();
                System.out.println(fileitem+"--"+s);
                inputstream = fileitem.getInputStream();
            }
        }

我得到的系统输出是:

代码语言:javascript
复制
Max File size allowed is (in bytes) :: 1048576
===> Uploading the file to :: /usr9/SIR06072/ifms/upld/indent
name=, StoreLocation=/usr9/SIR06072/ifms/upld/indent/upload__4272a855_14b151f83db__7f97_00000098.tmp, size=0bytes, isFormField=false, FieldName=importFile--

在文件名的位置,我收到一个空字符串。这不允许我上传文件。

有谁能帮帮我吗?

EN

回答 1

Stack Overflow用户

发布于 2015-01-28 12:58:42

代码语言:javascript
复制
class InnerThread2 {
  private int countDown = 5;

  private Thread t;

  public InnerThread2(String name) {
    t = new Thread(name) {
      public void run() {
        while (true) {
          System.out.println(this);
          if (--countDown == 0)
            return;
          try {
            sleep(10);
          } catch (InterruptedException e) {
            throw new RuntimeException(e);
          }
        }
      }

      public String toString() {
        return getName() + ": " + countDown;
      }
    };
    t.start();
  }
}

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28184877

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档