function uploadFile($type, $filename, $check_first = true, $debug = false)
 {
     $localPath = sfConfig::get('sf_image_dir') . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $filename;
     $input = $this->s3->inputResource($f = fopen($localPath, "rb"), filesize($s = $localPath));
     $uri = ImageTable::generateS3path($type, $filename);
     if ($check_first && $this->s3->getObjectInfo(sfConfig::get('app_amazon_s3_bucket'), $uri) !== false) {
         return;
     }
     if (S3::putObject($input, sfConfig::get('app_amazon_s3_bucket'), $uri, S3::ACL_PUBLIC_READ)) {
         print "UPLOADED: " . $uri . "\n";
     } else {
         if ($debug) {
             print "Couldn't upload image to S3: " . $uri . "\n";
         }
     }
 }