Nguyá»…n_6 -3 Newbie Poster

I am writing code to upload photos to Picasa, before the code runs well, now new picasa google upgrade. help yourself way up photos on picasa

Code old

$albumUrl = "$user/albumid/$/albumid";

    // XML Upload được cung cấp bởi google
    $rawImgXml = '<entry xmlns="">
                  <title>' . $path . '</title>
                  <summary>' . $path . '</summary>
                  <category scheme=""

    // Lấy thông tin File
    $fileSize = filesize($path);
    $fh = fopen($path, 'rb');
    $imgData = fread($fh, $fileSize);

    // Data header, cấu trúc được cung cấp bởi google
    $dataLength = strlen($rawImgXml) + $fileSize;
    $data = "";
    $data .= "\nMedia multipart posting\n";
    $data .= "--P4CpLdIHZpYqNn7\n";
    $data .= "Content-Type: application/atom+xml\n\n";
    $data .= $rawImgXml . "\n";
    $data .= "--P4CpLdIHZpYqNn7\n";
    $data .= "Content-Type: image/jpeg\n\n";
    $data .= $imgData . "\n";
    $data .= "--P4CpLdIHZpYqNn7--";
    $header = array(
        'GData-Version:  2', 
        'Authorization: '.$access_token,
        'Content-Type: multipart/related; boundary=P4CpLdIHZpYqNn7;', 
        'Content-Length: ' . strlen($data), 'MIME-version: 1.0'

    // Upload
    $ch = curl_init();  
    curl_setopt($ch, CURLOPT_URL, $albumUrl);  
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);  
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);  
    curl_setopt($ch, CURLOPT_POST, true);  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);  
    curl_setopt($ch, CURLOPT_HEADER, true);  
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);  
    $ret = curl_exec($ch);
    echo $ret;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.