Ignore:
Timestamp:
05/02/12 16:30:34 (12 years ago)
Author:
gustavo
Message:

Ticket #2676 - Falha ao anexar arquivo no expresso mail

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/post.php

    r5811 r6071  
    33 * com o source em base64 melhoria na performace. 
    44 */ 
     5 
    56$data = $_POST; 
     7         
    68if( count($_FILES) ) 
    79{ 
     
    1416                                $counter = count($files); 
    1517                                $files[$name.$counter] = array('name' => $file['name'][$counter],  
    16                                                                                                 'type' => $file['type'][$counter], 
    17                                                                                                 'source' => base64_encode(file_get_contents( $file['tmp_name'][$counter], $file['size'][$counter])), 
    18                                                                                                 'size' => $file['size'][$counter]); 
     18                                        'type' => $file['type'][$counter], 
     19                                        'source' => base64_encode(file_get_contents( $file['tmp_name'][$counter], $file['size'][$counter])), 
     20                                        'size' => $file['size'][$counter], 
     21                                        'error' => $file['error'][$counter] 
     22                                ); 
    1923                        } 
    2024                }else 
     
    2529} 
    2630 
     31if(isset($data['MAX_FILE_SIZE'])) 
     32        unset($data['MAX_FILE_SIZE']); 
     33         
    2734require_once "api/controller.php"; 
     35 
     36Controller::addFallbackHandler( 0, function($e){ throw $e; } ); 
    2837 
    2938$result = array(); 
     
    3342                $content = array($content); 
    3443                 
    35         foreach($content as $key => $value) 
    36                 $result[$concept][] =  isset($data['criteria']) ?  Controller::put( array( 'concept' => $concept ), $value, isset($data['criteria'])) : Controller::put( array( 'concept' => $concept ), $value); 
     44        foreach($content as $key => $value){ 
     45                try{ 
     46                        $result[$concept][] = Controller::put( array( 'concept' => $concept ), $value ); 
     47                }catch(Exception $e){ 
     48                        $result[$concept]['error'] = $e->getMessage();                   
     49                }  
     50        } 
    3751}        
    3852echo json_encode( $result ); 
Note: See TracChangeset for help on using the changeset viewer.