Project

General

Profile

« Previous | Next » 

Revision e5dbdbd0

IDe5dbdbd00bf7cb4148777dc6714c682677824d01
Parent ff113d4d
Child f7cc6422

Added by Jocelyn Delande over 8 years ago

bugfix validation : a lat/lon may be negative + better error displaying

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences

Changesets

uploadReceive.php
11 11
////////////////////// actions //////////////////////////////////////////
12 12

  
13 13
function handle_upload() {
14
  $upload_messages = array(
15
    UPLOAD_ERR_NO_FILE   => 'pas de fichier envoyé',
16
    UPLOAD_ERR_INI_SIZE  => 'fichier trop gros',
17
    UPLOAD_ERR_FORM_SIZE => 'fichier trop gros',
18
  );
19

  
14 20
  if (! is_dir(UPLOAD_PATH)) {
15 21
    if (! mkdir(UPLOAD_PATH)) {
16 22
      throw new UploadReceiveError(
......
28 34
        return $file_finalpath;
29 35
      } else {
30 36
        throw new UploadReceiveError(
31
          'Une erreur interne a empêché l\'envoi de l\'image :'. $file_err);
37
          'Une erreur interne a empêché l\'envoi de l\'image :'. $upload_messages[$file_err]);
32 38
      }
33 39
    } else {
34 40
      throw new UploadReceiveError(
......
51 57

  
52 58
////////////////////// main //////////////////////////////////////////
53 59

  
54
$fields_spec = array('lat'         => array('numeric', 'positive'),
55
                     'lon'         => array('numeric', 'positive'),
60
$fields_spec = array('lat'         => array('numeric'),
61
                     'lon'         => array('numeric'),
56 62
                     'alt'  => array('numeric', 'positive'),
57 63
                     'loop'  => array('boolean'),
58 64
                     'titre'  => array('required'),