Changeset 19 for trunk/upload.php


Ignore:
Timestamp:
May 27, 2003, 10:56:13 PM (21 years ago)
Author:
z0rglub
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/upload.php

    r10 r19  
    3434  $result = array();
    3535  $result['error'] = array();
    36   $i = 0;
    3736  //echo $_FILES['picture']['name']."<br />".$temp_name;
    3837  $extension = get_extension( $_FILES['picture']['name'] );
    3938  if ( $extension != 'gif' and $extension != 'jpg' and $extension != 'png' )
    4039  {
    41     $result['error'][$i++] = $lang['upload_advise_filetype'];
     40    array_push( $result['error'], $lang['upload_advise_filetype'] );
    4241    return $result;
    4342  }
     
    4544  {
    4645    // 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!" );
    4847  }
    4948  else if ( $_FILES['picture']['size'] > $my_max_file_size * 1024 )
    5049  {
    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' );
    5352  }
    5453  else
     
    5857    if ( !move_uploaded_file( $_FILES['picture']['tmp_name'], $temp_name ) )
    5958    {
    60       $result['error'][$i++] = $lang['upload_cannot_upload'];
     59      array_push( $result['error'], $lang['upload_cannot_upload'] );
    6160    }
    6261    else
     
    6766           and $size[0] > $image_max_width )
    6867      {
    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' );
    7170      }
    7271      if ( isset( $image_max_height )
     
    7473           and $size[1] > $image_max_height )
    7574      {
    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' );
    7877      }
    7978      // $size[2] == 1 means GIF
    8079      // $size[2] == 2 means JPG
    8180      // $size[2] == 3 means PNG
    82       if ( $size[2] != 1 and $size[2] != 2 and $size[2] != 3 )
     81      switch ( $size[2] )
    8382      {
    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'] ); 
    9788      }
    9889    }
     
    127118{
    128119  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' ).'">';
    130121  echo $lang['thumbnails'].'</a></div>';
    131122  exit();
Note: See TracChangeset for help on using the changeset viewer.