Please Help with error!

Discussion in 'PHP' started by inetfreebies, Nov 19, 2009.

  1. #1
    I am using a wordpress photo gallery plugin and I am receiving the following error when I upload a photo.

    Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in /home/******/public_html/alr/wp-content/plugins/wp-photo-album/wppa.php on line 651

    The .php file info is below.

    // check if thumbs dir exists
    if (!is_dir($wppa_dir . '/thumbs')) {
    mkdir($wppa_dir . '/thumbs');
    }

    foreach ($_FILES as $file) {
    Line 651 if (getimagesize($file['tmp_name'])) {
    $ext = substr(strrchr($file['name'], "."), 1);

    $query = "INSERT INTO " . PHOTO_TABLE . " (id, album, ext, name, description) VALUES (0, {$_POST['wppa-album']}, '$ext', '{$file['name']}', '')";
    $wpdb->query($query);
    //echo $query;
    $image_id = $wpdb->get_var("SELECT LAST_INSERT_ID()");

    $newimage = $wppa_dir . '/' . $image_id . '.' . $ext;
    copy($file['tmp_name'], $newimage);

    if (is_file ($newimage)) {
    $uploaded_a_file = TRUE;
    if (is_numeric(get_option('wppa_thumbsize'))) {
    $thumbsize = get_option('wppa_thumbsize');
    } else {
    $thumbsize = 130;
    }

    wppa_create_thumbnail($newimage, $thumbsize, '' );
    }
    }
    }

    if ($uploaded_a_file) { echo '<div id="message" class="updated fade"><p><strong>Photos Uploaded.</strong></p></div>'; }

    }

    Can someone please tell me how to fix this?
     
    inetfreebies, Nov 19, 2009 IP
  2. xenon2010

    xenon2010 Peon

    Messages:
    237
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    all I can say that variable $file['tmp_name'] is giving an empty value...
     
    xenon2010, Nov 19, 2009 IP