Changeset 19 for trunk/upload.php
- Timestamp:
- May 27, 2003, 10:56:13 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/upload.php
r10 r19 34 34 $result = array(); 35 35 $result['error'] = array(); 36 $i = 0;37 36 //echo $_FILES['picture']['name']."<br />".$temp_name; 38 37 $extension = get_extension( $_FILES['picture']['name'] ); 39 38 if ( $extension != 'gif' and $extension != 'jpg' and $extension != 'png' ) 40 39 { 41 $result['error'][$i++] = $lang['upload_advise_filetype'];40 array_push( $result['error'], $lang['upload_advise_filetype'] ); 42 41 return $result; 43 42 } … … 45 44 { 46 45 // do we even have a file? 47 $result['error'][$i++] = "You did not upload anything!";46 array_push( $result['error'], "You did not upload anything!" ); 48 47 } 49 48 else if ( $_FILES['picture']['size'] > $my_max_file_size * 1024 ) 50 49 { 51 $result['error'][$i++] =52 $lang['upload_advise_width'].$my_max_file_size.' KB';50 array_push( $result['error'], 51 $lang['upload_advise_width'].$my_max_file_size.' KB' ); 53 52 } 54 53 else … … 58 57 if ( !move_uploaded_file( $_FILES['picture']['tmp_name'], $temp_name ) ) 59 58 { 60 $result['error'][$i++] = $lang['upload_cannot_upload'];59 array_push( $result['error'], $lang['upload_cannot_upload'] ); 61 60 } 62 61 else … … 67 66 and $size[0] > $image_max_width ) 68 67 { 69 $result['error'][$i++] =70 $lang['upload_advise_width'].$image_max_width." px";68 array_push( $result['error'], 69 $lang['upload_advise_width'].$image_max_width.' px' ); 71 70 } 72 71 if ( isset( $image_max_height ) … … 74 73 and $size[1] > $image_max_height ) 75 74 { 76 $result['error'][$i++] =77 $lang['upload_advise_height'].$image_max_height." px";75 array_push( $result['error'], 76 $lang['upload_advise_height'].$image_max_height.' px' ); 78 77 } 79 78 // $size[2] == 1 means GIF 80 79 // $size[2] == 2 means JPG 81 80 // $size[2] == 3 means PNG 82 if ( $size[2] != 1 and $size[2] != 2 and $size[2] != 3)81 switch ( $size[2] ) 83 82 { 84 $result['error'][$i++] = $lang['upload_advise_filetype']; 85 } 86 else 87 { 88 switch ( $size[2] ) 89 { 90 case 1 : 91 $result['type'] = 'gif'; break; 92 case 2 : 93 $result['type'] = 'jpg'; break; 94 case 3 : 95 $result['type'] = 'png'; break; 96 } 83 case 1 : $result['type'] = 'gif'; break; 84 case 2 : $result['type'] = 'jpg'; break; 85 case 3 : $result['type'] = 'png'; break; 86 default : 87 array_push( $result['error'], $lang['upload_advise_filetype'] ); 97 88 } 98 89 } … … 127 118 { 128 119 echo '<div style="text-align:center;">'.$lang['upload_forbidden'].'<br />'; 129 echo '<a href="'.add_session_id_to_url( './ diapo.php' ).'">';120 echo '<a href="'.add_session_id_to_url( './category.php' ).'">'; 130 121 echo $lang['thumbnails'].'</a></div>'; 131 122 exit();
Note: See TracChangeset
for help on using the changeset viewer.