hi all i want to upload photos to picasa via my localhost. got coding from ibm.com(http://www.ibm.com/developerworks/library/x- picasalbum/) i am gettin an error lik this: Error: HTTP/1.1 400 Bad Request Expires: Tue, 15 Feb 2011 04:29:40 GMT Date: Tue, 15 Feb 2011 04:29:40 GMT Cache-control: private, max-age=0, must-revalidate Set-cookie: _rtok=9uq3p6B2Gx3_; Path=/; HttpOnly Set- cookie: S=photos_html=DtQxJuF9MXSK7SxvoYlzIw; Domain=.google.com; Path=/; HttpOnly Content-type: text/html; charset=UTF-8 X-content-type- options: nosniff X-frame-options: SAMEORIGIN X-xss-protection: 1; mode=block Server: GSE Connection: close A title or Slug header is required.
My add.php page is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Adding photos to an album</title> <style> body { font-family: Verdana; } li { border-bottom: solid black 1px; margin: 10px; padding: 2px; width: auto; padding-bottom: 20px; } h2 { color: red; text-decoration: none; } span.attr { font-weight: bolder; } </style> </head> <body> <h1>Add Photo</h1> <?php if (!isset($_POST['submit'])) { ?> <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" enctype="multipart/form-data"> <!-- Title: <br/> <input name="title" type="text" size="25" /><p/>--> File to upload: <br/> <input name="photofile" type="file" /><p/> Tags: <br/> <input name="tags" type="text" size="25" /><p/> <input name="submit" type="submit" value="Save" /> </form> <?php } else { // load classes require_once 'Zend/Loader.php'; Zend_Loader::loadClass('Zend_Gdata'); Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); Zend_Loader::loadClass('Zend_Gdata_Photos'); Zend_Loader::loadClass('Zend_Http_Client'); // connect to service $svc = Zend_Gdata_Photos::AUTH_SERVICE_NAME; $user = "[email protected]"; $pass = "XXX"; $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $svc); $gphoto = new Zend_Gdata_Photos($client); // validate input // sanitize input //$title = htmlentities($_POST['title']); $tags = htmlentities($_POST['tags']); // set album name $albumName = "test"; // construct photo object // save to server try { //print_r($_FILES['photofile']['tmp_name']);die(); $photo = $gphoto->newPhotoEntry(); // set file $file = $gphoto->newMediaFileSource($_FILES['photofile'] ['tmp_name']); $file->setContentType("image/jpeg"); $photo->setMediaSource($file); // set title //$photo->setSummary($gphoto->newSummary($title)); // set filename $photo->setTitle($gphoto->newTitle($filename)); // set tags $photo->mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup(); $keywords = new Zend_Gdata_Media_Extension_MediaKeywords(); $keywords->setText($tags); $photo->mediaGroup->keywords = $keywords; // link to album $album = $gphoto->newAlbumQuery(); $album->setUser($user); $album->setAlbumName($albumName); //print_r($album);die(); // save photo $gphoto->insertPhotoEntry($photo, $album->getQueryUrl()); } catch (Zend_Gdata_App_Exception $e) { echo "Error: " . $e->getResponse(); } echo 'Photo successfully added!'; } ?> </body> </html> Surfed the same issue in net but no use. could some1 help me properly. thanks haan -- You received this message because you are subscribed to the Google Groups "Google Picasa Web Albums API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-picasa-data-api?hl=en.
