Changeset 6071 for trunk/prototype
- Timestamp:
- 05/02/12 16:30:34 (12 years ago)
- Location:
- trunk/prototype
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/modules/mail/interceptors/Attachments.php
r5637 r6071 5 5 public function encodeCreateAttachment( &$uri , &$params , &$criteria , $original ){ 6 6 if(!isset($params['source'])) return false; 7 7 8 8 9 if(isset($_FILES[$params['source']])) 9 10 $params = $_FILES[$params['source']]; 10 11 12 if($params['error'] !== 0){ 13 switch ($params['error']){ 14 case 1: 15 throw new Exception('Tamanho de arquivo nao permitido!!! (php.ini)'); 16 case 2: 17 throw new Exception('Tamanho de arquivo nao permitido!!!'); 18 case 3: 19 throw new Exception('Ocorreu um erro durante o upload'); 20 case 4: 21 throw new Exception('Nao e um arquivo valido'); 22 } 23 } 24 11 25 $params['owner'] = Config::me('uidNumber'); 12 26 -
trunk/prototype/modules/mail/templates/attachment.ejs
r5785 r6071 1 < form id="fileupload_msg<%=data.ID%>" class="fileupload" action="mailAttachment:detail" method="POST">1 <div id="fileupload_msg<%=data.ID%>" class="fileupload" style="margin : 15px 0px -15px -10px;"> 2 2 <div class="row fileupload-buttonbar"> 3 3 <div class="button-files-upload"> … … 17 17 </div> 18 18 <br /> 19 </ form>19 </div> -
trunk/prototype/post.php
r5811 r6071 3 3 * com o source em base64 melhoria na performace. 4 4 */ 5 5 6 $data = $_POST; 7 6 8 if( count($_FILES) ) 7 9 { … … 14 16 $counter = count($files); 15 17 $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 ); 19 23 } 20 24 }else … … 25 29 } 26 30 31 if(isset($data['MAX_FILE_SIZE'])) 32 unset($data['MAX_FILE_SIZE']); 33 27 34 require_once "api/controller.php"; 35 36 Controller::addFallbackHandler( 0, function($e){ throw $e; } ); 28 37 29 38 $result = array(); … … 33 42 $content = array($content); 34 43 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 } 37 51 } 38 52 echo json_encode( $result );
Note: See TracChangeset
for help on using the changeset viewer.