1. #131
    Ext User
    Join Date
    Mar 2008
    Posts
    3
    Vote Rating
    0
    qianlei007 is on a distinguished road

      0  

    Default Thank you !

    Thank you !


    Thank you!

  2. #132
    Ext User
    Join Date
    Nov 2007
    Posts
    2
    Vote Rating
    0
    yulinyen is on a distinguished road

      0  

    Default


    Hi,

    I have integrated your work into my project, and it works perfectly, but when I try to upload a larger file, for example 40mb, it will always fail. Is there any file size limitation???

    The following is my php script for testing purpose:
    PHP Code:
    <?php

    $uploaddir 
    'upload/';
    $uploadfile $uploaddir.basename($_FILES['file']['name']);

    if (
    move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
        echo 
    json_encode(array('success' => true'message' => 'OK')) ;
    } else {
        echo 
    json_encode(array('success' => false'message' => 'Fail')) ;
    }

    ?>
    Thanks
    Last edited by yulinyen; 17 Mar 2008 at 12:49 AM. Reason: I forget to say thanks...

  3. #133
    Ext User
    Join Date
    Nov 2007
    Posts
    2
    Vote Rating
    0
    yulinyen is on a distinguished road

      0  

    Default


    I think I know the reason lo, I forgot the set the "post_max_size" of php.ini to a larger number.

  4. #134

  5. #135
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    508
    Vote Rating
    5
    MaximGB is on a distinguished road

      0  
    Use the force - read the source.

  6. #136
    Ext User kaki's Avatar
    Join Date
    Oct 2007
    Posts
    24
    Vote Rating
    0
    kaki is on a distinguished road

      0  

    Default Hi MaximGB!

    Hi MaximGB!


    would you like to help me why this servlet can not work with ext.ux.dialog but jsp?


    thx!


    Code:
     
    package com.hiber;
    import java.io.File;
    import java.io.IOException;
    import java.sql.Timestamp;
    import java.text.SimpleDateFormat;
    import java.util.Iterator;
    import java.util.List;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import org.apache.commons.fileupload.*;
    public class Upload extends HttpServlet {
     /**
      * 
      */
     private static final long serialVersionUID = 7440302204266787092L;
     String uploadPath = "d:\\uploadtest\\"; // 用于存放上传文件的目录
     String tempPath = "d:\\tmp\\"; // 用于存放临时文件的目录
     public Upload() {
      super();
      System.out.println("文件上传启动");
     }
     public void destroy() {
      super.destroy(); // Just puts "destroy" string in log
      // Put your code here
     }
     public void init() throws ServletException {
      System.out.println("文件上传初始化");
     }
     public void doPost(HttpServletRequest request, HttpServletResponse response)
       throws IOException, ServletException {
      try {
       System.out.println("开始进行文件上传");
       DiskFileUpload fu = new DiskFileUpload();
       fu.setSizeMax(4194304); // 设置最大文件尺寸,这里是4MB
       fu.setSizeThreshold(4096); // 设置缓冲区大小,这里是4kb
       fu.setRepositoryPath(tempPath); // 设置临时目录
       List fileItems = fu.parseRequest(request); // 得到所有的文件:
       Iterator i = fileItems.iterator();
       // 依次处理每一个文件:
       while (i.hasNext()) {
        FileItem fi = (FileItem) i.next();
        String fileName = fi.getName();// 获得文件名,这个文件名包括路径:
        if (fileName != null) {
         // 在这里可以记录用户和文件信息
         // 此处应该定义一个接口(CallBack),用于处理后事。
         // 写入文件a.txt,你也可以从fileName中提取文件名:
         String extfile = fileName.substring(fileName.indexOf("."));
         
         Timestamp now = new Timestamp((new java.util.Date())
           .getTime());
                      SimpleDateFormat   fmt   =   new   SimpleDateFormat("yyyyMMddHHmmssSSS");   
                     String  pfileName=   fmt.format(now).toString().trim();   
         System.out.println(uploadPath+pfileName+extfile);
         fi.write(new File(uploadPath + pfileName + extfile));
        }
       }
       response.setContentType("text/html;charset=utf-8");
       response.getWriter().print("{success:true,message:'上传成功'}");
       //response.getWriter().print("{success:true,msg:'成功'}");
       // 跳转到上传成功提示页面
      } catch (Exception e) {
       e.printStackTrace();
       response.getWriter().print("{success:flase,message:'失败'}");
       // 可以跳转出错页面
      }
     }
    }


    js:


    Code:
     
     
    Ext.onReady(function() {
     var dialog = new Ext.ux.UploadDialog.Dialog(null, {
      autoCreate : true,
      closable : true,
      collapsible : false,
      draggable : true,
      upload_autostart : true,
      minWidth : 500,
      minHeight : 200,
      width : 400,
      height : 350,
      proxyDrag : true,
      resizable : true,
      permitted_extensions : ['JPG', 'jpg', 'jpeg', 'JPEG', 'GIF', 'txt',
        'rar', 'gif', 'doc', 'xls'],
      constraintoviewport : true,
      title : '文件上传的例子',
      url : '/fileupload/',
      reset_on_hide : false,
      allow_close_on_upload : true
     });
     dialog.show('my-dlg');
    });


    but it works in jsp like this:

    Code:
     
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
    <form action="fileupload" method="post" enctype="multipart/form-data" name="form1">
      <input name="thisfile" type="file" id="thisfile">
      <input name="user" type="text" id="user" size="10">
      <input type="submit" name="Submit" value="Submit">
    </form>
    </body>
    </html>

  7. #137

  8. #138
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    508
    Vote Rating
    5
    MaximGB is on a distinguished road

      0  

    Default


    Can you confirm that your servlet is at least called. Since fileupload and /fileupload/ are different URLs actually.
    Use the force - read the source.

  9. #139
    Sencha User
    Join Date
    Apr 2008
    Posts
    80
    Vote Rating
    0
    shuang is on a distinguished road

      0  

    Smile ask for help

    ask for help


    hi MaximGB

    i'm ask for help

    can u check my script from link http://extjs.com/forum/showthread.ph...692#post153692 ?

    very thank you.

  10. #140
    Ext JS Premium Member
    Join Date
    Mar 2008
    Location
    Moscow
    Posts
    137
    Vote Rating
    0
    Chemist is on a distinguished road

      0  

    Default


    I've got some strange problem.

    var dialog = new Ext.ux.UploadDialog.Dialog({url: '/ui/files/FileOps.aspx',
    reset_on_hide: false,
    allow_close_on_upload: true,
    upload_autostart: false });

    dialog.setBaseParams({comment:'Test'});
    dialog.show('');


    Dialog shows, works, but parameter 'comment' is not sent in the post of the form...

    I'm using last Ext.ux.UploadDialog from your site and ExtJS 2.1

    Thanx