topical media & game development

talk show tell print

mashup-flickr-13-Complete-gallery-doUpload.php / php



  <?php 
  include (dirname(__FILE__) . '/../lib/gallery.php');
  gallery = new FlickrGallery();        
  gallery->authenticate("write");
  if (!gallery->checkAuthenticatedUser())
  {
    gallery->error("You do not have permission to upload photos to this account");
  }
  
  size = _FILES['file']['size'];
  filename = _FILES['file']['tmp_name'];
  
  title = stripslashes(_REQUEST['title']);
  description = stripslashes(_REQUEST['description']);
  tags = stripslashes(_REQUEST['tags']);
  privacy = _REQUEST['privacy'];
  
  if (!empty(filename) && is_uploaded_file(filename) && size > 0)
  {
    isPublic = 0;
    isFriend = 0;
    isFamily = 0;
  
    switch (privacy)
    {
      case "public": 
        isPublic = 1;
        break;
  
      case "friends": 
        isFriend = 1;
        break;
  
      case "family": 
        isFamily = 1;
        break;
  
      case "friendsfamily": 
        isFriend = 1;
        isFamily = 1;
        break;
  
    }
  
    id = gallery->uploadPhoto(filename, title, description, tags, isPublic, 
      isFriend, isFamily);
  }
  
  header('Location: http://' . _SERVER['HTTP_HOST'] . dirname(_SERVER['PHP_SELF']) 
    . '/index.php');
   ?>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.