Changeset 3881


Ignore:
Timestamp:
03/21/11 14:17:53 (13 years ago)
Author:
alexandrecorreia
Message:

Ticket #1648 - Correcao( codigo ) e melhoria( laytou/informacao ) no upload de arquivos para o servidor.

Location:
branches/2.2/filemanager
Files:
3 edited

Legend:

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

    r3879 r3881  
    2323$show_upload_boxes      = count($_FILES['upload_file']['name']); 
    2424$filesUpload                            = $_FILES['upload_file']; 
    25  
    26  
    27 error_log( print_r($_FILES['upload_file'], true), 3, "/tmp/log" ); 
    2825 
    2926function create_summaryImage($file) 
     
    10299                elseif( $_FILES['upload_file']['size'][$i] > 0 ) 
    103100                { 
    104                         if( $badchar = $bo->bad_chars($_FILES['upload_file']['name'][$i], True, True )) 
     101                        $badchar = $bo->bad_chars( $_FILES['upload_file']['name'][$i], True, True ); 
     102                         
     103                        if( $badchar ) 
    105104                        { 
    106105                                $return[] = array( 
     
    219218                } 
    220219        } 
     220         
     221        error_log(print_r($return, true), 3, "/tmp/log"); 
    221222} 
    222223 
  • branches/2.2/filemanager/js/handler.js

    r3880 r3881  
    232232        function upload(data) 
    233233        { 
    234                 var response = unserialize(data); 
    235  
    236                 if ( response[0] == "Ok" ) 
    237                 { 
    238                         write_msg(get_lang('All files created sucessfuly')); 
    239                         _winBuild( "dwindownewUpload" , "remove" );      
    240                 } 
    241                 else 
     234                var _inputs             = document.getElementsByTagName('input'); 
     235                var response    = unserialize(data); 
     236 
     237                if ( response[0] != "Ok" ) 
    242238                {        
    243                         var _inputs                     = document.getElementsByTagName('input'); 
    244                         var removeInputs        = null; 
    245                          
    246239                        for( var i = 0; i < response.length; i++ ) 
    247240                        { 
    248241                                for( var j = 0 ; j < _inputs.length ; j++ ) 
    249242                                { 
    250                                         if( _inputs[j].getAttribute('type') == 'file' ) 
     243                                        if( _inputs[j].getAttribute('type') == "file") 
    251244                                        {        
    252                                                 if( _inputs[j].value.indexOf( response[i]['file'] ) > -1 ) 
    253                                                 { 
     245                                                var _indexOf = response[i]['file'].toUpperCase().indexOf(_inputs[j].value.toUpperCase() ); 
     246                                                 
     247                                                if( response[i]['file'].toUpperCase() === _inputs[j].value.toUpperCase() && _indexOf > -1 ) 
     248                                                {        
     249                                                        _inputs[j].setAttribute("erroUpload", "true"); 
     250                                                         
    254251                                                        var _parent     = _inputs[j].parentNode; 
    255252                                                        var _div = _parent.firstChild;   
     
    267264                                                                                          + borkb( response[i]['size'] ) + "  - Permitido  " + borkb( response[i]['size_max'] ); 
    268265                                                        } 
    269                                                         else    if( response[i]['badchar'] ) 
     266                                                        else if( response[i]['badchar'] ) 
    270267                                                        {        
    271268                                                                _div.innerHTML = "<span style='font-weight:bold' >Erro </span>:: "  + response[i]['badchar'];    
    272269                                                        } 
    273                                                         else    if( response[i]['directory'] ) 
     270                                                        else if( response[i]['directory'] ) 
    274271                                                        {        
    275272                                                                _div.innerHTML = "<span style='font-weight:bold' >Erro </span>:: "  + response[i]['directory'];  
    276273                                                        } 
    277                                                         else    if( response[i]['sendFile'] ) 
     274                                                        else if( response[i]['sendFile'] ) 
    278275                                                        {        
    279276                                                                _div.innerHTML = "<span style='font-weight:bold' >Erro </span>:: "  + response[i]['sendFile'];   
    280277                                                        } 
    281                                                         else    if( response[i]['undefined'] ) 
     278                                                        else if( response[i]['undefined'] ) 
    282279                                                        { 
    283280                                                                _div.innerHTML = "<span style='font-weight:bold' >Erro </span>:: "  + response[i]['undefined'];  
    284281                                                        } 
    285282                                                } 
    286                                                 else 
    287                                                         removeInputs = _inputs[j]; 
    288283                                        } 
    289284                                }        
    290                                  
    291                                 if( removeInputs != null ) 
    292                                 {        
    293                                         removeInputs.parentNode.parentNode.removeChild( removeInputs.parentNode ); 
    294                                         removeInputs = null; 
     285                        } 
     286                         
     287                        for( var j = 0 ; j < _inputs.length ; j++ ) 
     288                        {        
     289                                if ( !_inputs[j].getAttribute("erroUpload") && _inputs[j].getAttribute('type') == "file" ) 
     290                                { 
     291                                        _inputs[j].parentNode.parentNode.removeChild( _inputs[j].parentNode ); 
    295292                                } 
    296                         }        
     293                        } 
     294                } 
     295                else 
     296                { 
     297                        write_msg(get_lang('All files created sucessfuly')); 
     298                        _winBuild( "dwindownewUpload" , "remove" );      
    297299                }        
    298300 
  • branches/2.2/filemanager/tp/expressowindow/xsl/upload.xsl

    r3879 r3881  
    4141                                                <div></div> 
    4242                                                <input maxlength="255" name="upload_file[]" type="file" style="margin-right:5px" /> 
    43                                                 <input name="upload_comment[]" type="text"/> 
    44                                                 <input type="hidden" name="uploadprocess" value="true"/> 
    45                                                 <input type="hidden" name="path" value="{$path}"/> 
     43                                                <input name="upload_comment[]" type="text" /> 
     44                                                <input type="hidden" name="uploadprocess" value="true" /> 
     45                                                <input type="hidden" name="path" value="{$path}" /> 
    4646                                        </div> 
    4747                                         
Note: See TracChangeset for help on using the changeset viewer.