Changeset 2592 for trunk/include


Ignore:
Timestamp:
Sep 26, 2008, 1:01:35 AM (16 years ago)
Author:
plg
Message:

feature 868 added: pwg.images.add checks if the same file has not alread
been uploaded.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/ws_functions.inc.php

    r2585 r2592  
    903903  // fwrite($fh_log, 'input:  '.$params['thumbnail_sum']."\n");
    904904
     905  // does the image already exists ?
     906  $query = '
     907SELECT
     908    COUNT(*) AS counter
     909  FROM '.IMAGES_TABLE.'
     910  WHERE md5sum = \''.$params['file_sum'].'\'
     911;';
     912  list($counter) = mysql_fetch_row(pwg_query($query));
     913  if ($counter != 0) {
     914    return new PwgError(500, 'file already exists');
     915  }
     916
    905917  // current date
    906918  list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
     
    987999    'width' => $width,
    9881000    'height' => $height,
     1001    'md5sum' => $params['file_sum'],
    9891002    );
    9901003
Note: See TracChangeset for help on using the changeset viewer.