Changeset 5514 for trunk/prototype/post.php
- Timestamp:
- 02/14/12 16:52:04 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/post.php
r5399 r5514 1 1 <?php 2 3 if( !isset($_REQUEST['data']) ) return; 4 5 $data = $_REQUEST['data']; unset( $_REQUEST['data'] ); 2 /* Upload de arquivos e encaminhado para seu respectivo conceito 3 * com o source em base64 melhoria na performace. 4 */ 5 $data = $_POST; 6 if( count($_FILES) ) 7 { 8 $files = array(); 9 foreach( $_FILES as $name => $file ) 10 { 11 if( is_array( $file['name'] ) ) 12 { 13 foreach( $file['name'] as $key => $value ){ 14 $counter = count($files); 15 $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]); 19 } 20 }else 21 $files[$name] = $file; 22 } 23 24 $_FILES = $files; 25 } 6 26 7 27 require_once "api/controller.php"; 8 28 9 echo json_encode( Controller::put( $_REQUEST, $data ) ); 29 $result = array(); 30 foreach( $data as $concept => &$content ) 31 { 32 if(!is_array($content)) 33 $content = array($content); 34 35 foreach($content as $key => $value) 36 $result[$concept][] = Controller::put( array( 'concept' => $concept ), $value, isset($data['criteria']) ? $data['criteria'] : false ); 37 } 38 echo json_encode( $result );
Note: See TracChangeset
for help on using the changeset viewer.