This is a drop-in replacement for the 'go.php' in the Gallery2Flickr script provided by 'myrmi'

Download the modified source as a text file or view it here:
<?
session_start
();

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/*
 * To make this work, you must first go create an API key under Flickr
 * Services.  This should be the URL:
 *   http://www.flickr.com/services/api/
 *
 * Once the API key is created, you have to edit the configuration.
 * You can do this by listing your registered keys:
 *   http://www.flickr.com/services/api/registered_keys.gne
 *
 * Set the Application Title to: Gallery2Flickr
 * Set the Callback URL to: 
 *   http://www.yourdomain.com/path/to/gallery/albums/go.php
 *
 * Take the API Key and the Shared Secret provided and enter them below:
 */


//These are the variables you have to set
$api_key "";
$secret "";


//Do you want to let flickr handle the EXIF data in the file, or use the date taken stored by Gallery?
//No other data is taken from Gallery - only date taken, so all other EXIF data will be handled by flickr, if present
//Default lets flickr handle it
$useExif true;

//How do you want to upload your photos? 1 is visible to that category, 0 is hidden to that category
//To upload privately, set all of these to 0
$public "1";
$friends "1";
$family "1";
 
//Allowed extensions
$allowed_ext "jpg, JPG, jpeg, JPEG, gif, GIF, png, PNG";

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
//Put the allowed extentions into an array
$allowed explode(', '$allowed_ext);
 
$k $_GET['gallery'];
//$i = $_GET['i'];
$setid $_GET['setid'];
if (!isset(
$_SESSION[$k.'count']))
{
    
$_SESSION[$k.'count'] = 0;
}
if (!isset(
$_SESSION[$k.'notallowed']))
{
    
$_SESSION[$k.'notallowed'] = 0;
}
if (!isset(
$_SESSION[$k.'exists']))
{
    
$_SESSION[$k.'exists'] = 0;
}

class 
AlbumItem {}
class 
Image {}
class 
Album {}
class 
Comment {}

require_once(
"phpFlickr.php");

$f = new phpFlickr($api_key$secretfalse);

if (!isset(
$_SESSION['phpFlickr_auth_token']) && !isset($_GET['frob']))
{
    
$f->auth("write");
}
else
{
    if (isset(
$_GET['frob']))
    {
        
$auth_token $f->auth_getToken($_GET['frob']);
        
$_SESSION['phpFlickr_auth_token'] = $auth_token;
    }
    
$f->setToken($_SESSION['phpFlickr_auth_token']);
    echo 
"Authentication with Flickr successful.<br><br>";
}

flush();

echo 
"Processing Album Data...<br><br>";
flush();

$albumdata unserialize(file_get_contents($pathtoalbumdb "albumdb.dat"));


// this part appears to list the albums
if ( ($_GET['gallery'] == "" ) || ($_GET['i'] == "") )
{
    if (
$_GET['gallery'] == "" )
    {
    }

    if ((
$_SESSION[$k.'count'] > 0)
            || (
$_SESSION[$k.'notallowed'] > 0)
            || (
$_SESSION[$k.'exists'] > 0))
    {
        echo 
"Total Images uploaded: " $_SESSION[$k.'count'] . "<br>";
        echo 
"Total Unsupported Files skipped: " $_SESSION[$k.'notallowed'] . "<br>";
        echo 
"Total pre-existing skipped: " $_SESSION[$k.'exists'] . "<br>";
    }    
    
$_SESSION[$k.'count'] = 0;
    
$_SESSION[$k.'notallowed'] = 0;
    
$_SESSION[$k.'exists'] = 0;
 
    for(
$k 0$k count($albumdata); $k++) 
    {
        
        if ((
$albumdata[$k] != "PEAR") && ($albumdata[$k] != "phpFlickr"))
        { 
            
//an ugly hack, but gallery can end up adding the PEAR directory to the database, so skip over it if it's there.

            
echo "To transfer " $albumdata[$k] . ", click <a href='./go.php?gallery=" $k "&i=0'>here</a><br/>";

            
flush();
        }
    }


// this part appears to do the photo uploading.
else 
{
    
//Does a photoset for this album already exist?
    //It might do. Let's check
    
    //but not every time...
    
    
if ( $_GET['setid'] != "" 
    {
        
$setpresent true;
  } 
  else 
  {
        
$setpresent false;
        
        
//Could still exist, but we'd be resuming
        
$sets $f->photosets_getList();
        
        for (
$n 0$n count($sets); $n++)
        {
            if (
$sets[photoset][$n][title] == $albumdata[$k])
            {
                
$setpresent true;
                
//set the id
                
$setid $sets[photoset][$n][id];
            } 
//if
        
// for
    
// else
    
    
    
flush();
    
$data file_get_contents("./" $albumdata[$k] . "/photos.dat");

    
$data unserialize($data);
    
    echo 
"There are " count($data) . " items found in this album.<br>";
    for (
$j 0$j 4000$j++)    echo $j;
    
flush();

    
// loops through the images
    
for ($i 0$i count($data); $i++)
    {
        
        
flush();
        
//Image name
        
$name $data[$i]->image->name;

        
//Image type
        
$type $data[$i]->image->type;

        
//Description
        
$description $data[$i]->caption;

        
//Tags
        
$tags str_replace(" "","$data[$i]->keywords);

        
$comment "";
        for(
$j 0$j count($data[$i]->comments); $j++) 
        {
            
$comment .= "\n\n<i>".$data[$i]->comments[$j]->name" said:</i> " $data[$i]->comments[$j]->commentText;
        }

        
//Add to description of photo
        
$description .= $comment;

        
//Does the photo exist in the photoset (if the photoset exists)?
     
        
$photoexists false;
     
        if (
$setid != ""
        {
            
$photos $f->photosets_getPhotos($setid);
         
            for (
$p 0$p count($photos[photo]); $p++)
            {
                if (
$photos[photo][$p][title] == $name)
                {
                    
$photoexists true;
                } 
// if
            
}//for
        
}//if

     
        //Check good file extension
        
$good false;
        for (
$m 0$m count($allowed); $m++)
        {
            if (
$allowed[$m] == $type)
            {
                
$good true;
            }
//if
        
}//for

        
flush();

//        echo "Total Images uploaded: " . $_SESSION[$k.'count'] . "<br>";
//        echo "Total Unsupported Files skipped: " . $_SESSION[$k.'notallowed'] . "<br>";
//        echo "Total pre-existing skipped: " . $_SESSION[$k.'exists'] . "<br>";

        
if ( $good && !$photoexists 
        {
            
//i.e. if the file has a valid extension and isn't already in the set...
            
echo "<div><span><a href='" "./" $albumdata[$k] . "/" $name "." $type "'>";
            echo 
"<img src='" "./" $albumdata[$k] . "/" $name ".thumb." $type "'>";
            echo 
"</a>";
            echo (
$i+1).": Uploading the image titled '"$name "' with a description '"$description ."' and tags '".$tags."'<br/>";

            
// Generate extra bytes of data to force a flush.
            
echo "<!--";
            for (
$j 0$j 3500$j++)
            {
                echo 
"$i";
            }
            echo 
"-->";
            
flush();
            
$photoid $f->sync_upload("./" $albumdata[$k] . "/" $name "." $type$name$description$tags$public$friends$family);
            
            
$_SESSION[$k.'count'] += 1;
    

            
// ***
            // *** this appears to reset phpFlickr somehow, perhaps it's because this
            // *** is missing some sort of call to finish the upload?  don't know.
            // ***   -eric
            // *** 

            //Not sure why the 'refresh' below is necessary. 
            //Without it, when calling either of the functions below I get a "#112 Method not found" error.
            
$f->phpFlickr($api_key$secretfalse);


            if (
$setid == "")
            {
                
//create set with photo as Primary photo
                
echo "Creating new set: \'" $albumdata[$k] . "\'<br>";
                
flush();
                
$setid $f->photosets_create($albumdata[$k], ""$photoid);
                
$setid $setid[id];
            } 
            else 
            {
                
//add photo to set
                
echo "Adding photo to set.<br>";
                
flush();
                
$r $f->photosets_addPhoto($setid$photoid);
                if (!
$r)
                {
                    echo 
"<br>Error adding photo (Set ID: $setid  Photo ID: $photoid)<br>Trying again...<br>";
                    
flush();
                    
$r $f->photosets_addPhoto($setid$photoid);
                    if (!
$r)
                    {
                        die(
"<br>Error adding photo (Set ID: $setid  Photo ID: $photoid)<br>");
                        
flush();
                    }
                }
            }
    
            
//Now make the date on the photo correct, if the data is in the photos.dat file
    
            //If there is a year set, assume that the data in this file is true
    
            
if ($data[$i]->itemCaptureDate[year] != "" && $useExif == false 
            {
                
//construct the date line according to the MYSQL format
                
                
$date $data[$i]->itemCaptureDate[year
                        . 
"-" 
                        
$data[$i]->itemCaptureDate[mon
                        . 
"-" 
                        
$data[$i]->itemCaptureDate[mday
                        . 
" " 
                        
$data[$i]->itemCaptureDate[hours
                        . 
":" 
                        
$data[$i]->itemCaptureDate[minutes
                        . 
":" 
                        
$data[$i]->itemCaptureDate[seconds];
                
                
//Set it - again needs the refresh...
                
$f->phpFlickr($api_key$secretfalse);
                
                
$f->photos_setDates($photoid$date );
            }
//if
        
}//if
        
else 
        {
            if (!
$good
            {
                
$_SESSION[$k.'notallowed'] += 1;
                echo 
"The file " $name "." $type " wasn't uploaded, because it is of a type Flickr won't allow.";
            }
//if

            
if ($photoexists
            {
                
$_SESSION[$k.'exists'] += 1;
                echo 
"The file " $name "." $type " wasn't uploaded, because it appears to already be in the photoset.";    
            }
//if
        
}//else
        
echo "</span></div>";    
        
flush();
    
        
// Generate extra bytes of data to force a flush.
        
echo "<!--";
        for (
$j 0$j 3500$j++)
        {
            echo 
"$i";
        }
        echo 
"-->";
        
flush();
    }
// for
    
    
if (($_SESSION[$k.'count'] > 0)
            || (
$_SESSION[$k.'notallowed'] > 0)
            || (
$_SESSION[$k.'exists'] > 0))
    {
        echo 
"Total Images uploaded: " $_SESSION[$k.'count'] . "<br>";
        echo 
"Total Unsupported Files skipped: " $_SESSION[$k.'notallowed'] . "<br>";
        echo 
"Total pre-existing skipped: " $_SESSION[$k.'exists'] . "<br>";
    }    
    
$_SESSION[$k.'count'] = 0;
    
$_SESSION[$k.'notallowed'] = 0;
    
$_SESSION[$k.'exists'] = 0;

    echo 
'<br><br><a href="go.php?gallery='.$k.'">Return to List</a><br><br>';
}

?>