Changeset 3889


Ignore:
Timestamp:
03/22/11 18:19:49 (13 years ago)
Author:
alexandrecorreia
Message:

Ticket #1660 - Enviar arquivos pelo filemanager, tratado o erro para o php.

Location:
branches/2.2/filemanager
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/filemanager/inc/upload.php

    r3881 r3889  
    22 
    33require_once '../../header.session.inc.php'; 
     4 
     5$post_limit = error_get_last( ); 
     6 
     7if ( preg_match( '/POST Content-Length of (\d+) bytes exceeds the limit of \d+ bytes/i', $post_limit[ 'message' ], $matches ) ) 
     8{ 
     9        $_SESSION['response'] =  serialize( array( 
     10                 'postsize' => $matches[ 1 ], 
     11                 'max_postsize' => ini_get( 'post_max_size' ) 
     12        ) ); 
     13        exit; 
     14} 
    415 
    516/* This single file is used to increase upload_max_filesize and post_max_size using .htaccess*/ 
     
    8697if( $path != '/' ) 
    8798{ 
     99        $return = array( ); 
    88100        for( $i = 0; $i != $show_upload_boxes; $i++) 
    89101        { 
    90                 if ( $_FILES['upload_file']['size'][$i] > ($upload_max_size*1024*1024) ) 
     102                if ( $_FILES['upload_file']['error'][$i] !== 0 ) 
     103                { 
     104                        $return[] = array(  
     105                                        "file"          => $_FILES['upload_file']['name'][$i] , 
     106                                        "filesize"      => 'filesize #' . $_FILES['upload_file']['error'][$i] 
     107                         ); 
     108                        continue; 
     109                } 
     110                elseif ( $_FILES['upload_file']['size'][$i] > ($upload_max_size*1024*1024) ) 
    91111                { 
    92112                        $return[] = array(  
     
    219239        } 
    220240         
    221         error_log(print_r($return, true), 3, "/tmp/log"); 
     241        //error_log(print_r($return, true), 3, "/tmp/log"); 
    222242} 
    223243 
  • branches/2.2/filemanager/inc/uploadApp.php

    r3610 r3889  
    11<?php 
    2 session_id($_GET['id']); 
     2 
     3session_id( $_GET['id'] ); 
    34session_start(); 
    4 setcookie('jupload',$_GET['id'], time()+3600); 
     5setcookie( 'jupload', $_GET['id'], time()+3600 ); 
    56 
    67include 'jupload.php'; 
    7 function handle_uploaded_files($juploadPhpSupportClass, $files) { 
     8 
     9function handle_uploaded_files($juploadPhpSupportClass, $files)  
     10{ 
    811        return 
    912                "<P>We are in the 'handle_uploaded_files' callback function, in the index.php script. To avoid double coding, we " 
     
    1316 
    1417} 
     18 
     19// Set Max File Size 
     20$maxFileSize = "10M"; 
     21 
     22if ( file_exists('setFileMaxSize.php') ) 
     23{ 
     24        require_once('setFileMaxSize.php'); 
     25        $maxFileSize  = unserialize(base64_decode($SET_FILE_MAX_SIZE)); 
     26        $maxFileSize  = trim($maxFileSize)."M"; 
     27} 
     28 
    1529$appletParameters = array( 
    16     'maxFileSize' => '5G', 
    17     'maxChunkSize' => '1600000', 
    18         'archive' => '../tp/juploader/wjhk.jupload.jar', 
    19         'afterUploadURL' => 'after_upload.php', 
    20         'sendMD5Sum' => 'true', 
    21         'showLogWindow' => 'false', 
    22         'debugLevel' => 0  
    23 ); 
     30                                                        'maxFileSize' => $maxFileSize, 
     31                                                        'maxChunkSize' => '1600000', 
     32                                                        'archive' => '../tp/juploader/wjhk.jupload.jar', 
     33                                                        'afterUploadURL' => 'after_upload.php', 
     34                                                        'sendMD5Sum' => 'true', 
     35                                                        'showLogWindow' => 'false', 
     36                                                        'debugLevel' => 0  
     37                                                ); 
     38 
    2439$classParameters = array( 
    25         'demo_mode' => false, 
    26         'allow_subdirs' => true, 
    27         'destdir' => '/tmp'  //Where to store the files on the webserver  
    28 ); 
     40                                                        'demo_mode' => false, 
     41                                                        'allow_subdirs' => true, 
     42                                                        'destdir' => '/tmp'  //Where to store the files on the webserver  
     43                                                ); 
    2944 
    3045$juploadPhpSupportClass = new JUpload($appletParameters, $classParameters); 
     
    3348echo '<div align="left"><!--JUPLOAD_APPLET--></div>'; 
    3449 
    35  
    3650?> 
  • branches/2.2/filemanager/js/handler.js

    r3882 r3889  
    8484                folders = unserialize(data); 
    8585 
    86                 var rootFold = new dNode({id:'root', caption: get_lang("Directories") }); 
     86                var rootFold = new dNode({id:'root', caption: get_lang("Directories")}); 
    8787                folders_tree.add(rootFold,'root'); 
    8888 
     
    237237                var response    = unserialize(data); 
    238238 
     239                if ( response[ 'postsize' ] ) 
     240                { 
     241                        /* 
     242                         *  
     243                         * response['postize'] = ERRO POST; 
     244                         * response['max_postsize] = diretiva do PHP para POST_MAX_SIZE; 
     245                         *  
     246                         */  
     247                         
     248                        write_msg( get_lang("ERROR: Use the advanced file sending!") ); 
     249                        return false; 
     250                } 
     251 
    239252                if ( response[0] != "Ok" ) 
    240                 {        
     253                { 
    241254                        for( var i = 0; i < response.length; i++ ) 
    242255                        { 
     
    259272                                                        _div.style.background   = "url('"+path_filemanager+"images/warning.gif') no-repeat left top"; 
    260273                                                        _div.style.cursor                       = "pointer"; 
    261                                                         _div.onclick    = function(){ this.style.display = 'none'; } ; 
     274                                                        _div.onclick    = function(){this.style.display = 'none';} ; 
    262275                                                         
    263276                                                        if( response[i]['size_max'] ) 
     
    281294                                                        { 
    282295                                                                _div.innerHTML = "<span style='font-weight:bold' >Erro </span>:: "  + response[i]['undefined'];  
     296                                                        } 
     297                                                        else if( response[i]['filesize'] ) 
     298                                                        { 
     299                                                                _div.innerHTML = "<span style='font-weight:bold' >Erro </span>:: "  + response[i]['filesize'];   
    283300                                                        } 
    284301                                                } 
  • branches/2.2/filemanager/setup/phpgw_pt-br.lang

    r3885 r3889  
    4747created by      filemanager     pt-br   Criado por 
    4848Error:  filemanager     pt-br   Erro: 
     49ERROR: Use the advanced file sending!   filemanager     pt-br   ERRO: Utilize o envio avançado de arquivos! 
    4950Are you sure you want to delete filemanager     pt-br   Você tem certeza que deseja apagar 
    5051Please type the text "%1" to delete     filemanager     pt-br   Por favor, tenha certeza e digite "%1" para apagar 
  • branches/2.2/filemanager/templates/default/config.tpl

    r3019 r3889  
    11<!-- BEGIN header --> 
     2<script src='filemanager/inc/load_lang.php'></script> 
     3<script src='filemanager/js/connector.js'></script> 
     4<script src='filemanager/js/common_functions.js'></script> 
     5 
    26<form method="POST" action="{action_url}"> 
    3 <table border="0" align="center"> 
    4    <tr bgcolor="{th_bg}"> 
    5     <td colspan="2"><font color="{th_text}">&nbsp;<b>{title}</b></font></td> 
    6    </tr> 
     7        <table border="0" align="center"> 
     8                <tr bgcolor="{th_bg}"> 
     9                        <td colspan="2"> 
     10                                <font color="{th_text}">&nbsp;<b>{title}</b></font> 
     11                        </td> 
     12                </tr> 
    713<!-- END header --> 
    814<!-- BEGIN body --> 
    9     <tr bgcolor="{row_on}"> 
    10     <td>{lang_Max_file_size}</td> 
    11     <td> 
    12     <input size="3" name="newsettings[filemanager_Max_file_size]" value="{value_filemanager_Max_file_size}">&nbsp;Mb 
    13     </td> 
    14     </tr> 
    15     <tr bgcolor="{row_off}"> 
    16     <td>{lang_quota_size}</td> 
    17     <td> 
    18     <input size="3" name="newsettings[filemanager_quota_size]" value="{value_filemanager_quota_size}">&nbsp;Mb 
    19     </td> 
    20     </tr> 
    21     <tr bgcolor="{row_on}"> 
    22     <td>{lang_antivirus_command}</td>  
    23     <td> 
    24     <input size="40" name="newsettings[filemanager_antivirus_command]" value="{value_filemanager_antivirus_command}"> 
    25     </td> 
    26     </tr> 
     15                <tr bgcolor="{row_on}"> 
     16                        <td>{lang_Max_file_size}</td> 
     17                        <td> 
     18                                <input size="3" name="newsettings[filemanager_Max_file_size]" value="{value_filemanager_Max_file_size}">&nbsp;Mb 
     19                        </td> 
     20                </tr> 
     21                <tr bgcolor="{row_off}"> 
     22                        <td>{lang_quota_size}</td> 
     23                        <td> 
     24                                <input size="3" name="newsettings[filemanager_quota_size]" value="{value_filemanager_quota_size}">&nbsp;Mb 
     25                        </td> 
     26                </tr> 
     27                <tr bgcolor="{row_on}"> 
     28                        <td>{lang_antivirus_command}</td>  
     29                        <td> 
     30                                <input size="40" name="newsettings[filemanager_antivirus_command]" value="{value_filemanager_antivirus_command}"> 
     31                        </td> 
     32                </tr> 
    2733 
    2834<!-- END body --> 
    2935<!-- BEGIN footer --> 
    30   <tr bgcolor="{th_bg}"> 
    31     <td colspan="2"> 
    32 &nbsp; 
    33     </td> 
    34   </tr> 
    35   <tr> 
    36     <td colspan="2" align="center"> 
    37       <input type="submit" name="submit" value="{lang_submit}"> 
    38       <input type="submit" name="cancel" value="{lang_cancel}"> 
    39     </td> 
    40   </tr> 
    41 </table> 
     36                <tr bgcolor="{th_bg}"> 
     37                        <td colspan="2">&nbsp;</td> 
     38                </tr> 
     39                <tr> 
     40                        <td colspan="2" align="center"> 
     41                                <input type="button" value="{lang_submit}" onclick="maxFileSize(document);"> 
     42                                <!-- 
     43                                        No MSIE utilizar um botão do tipo submit não permite que seja gravado o arquivo e configuração. 
     44                                        Por esse motivo o envio do formulário está sendo feito através do javascript. 
     45                                        NÃO REMOVA...                     
     46                                --> 
     47                                <input type="submit" name="submit" style="display: none"> 
     48                                <input type="submit" name="cancel" value="{lang_cancel}"> 
     49                        </td> 
     50                </tr> 
     51        </table> 
    4252</form> 
    4353<!-- END footer --> 
Note: See TracChangeset for help on using the changeset viewer.