Note that there are some explanatory texts on larger screens.

plurals
  1. POUploading file with Youtube API v3 and PHP
    primarykey
    data
    text
    <p>I'm trying to upload a file to youtube using the new api v3. Here's what I do...</p> <pre><code>public function upload(){ if(isset($_FILES['userfile'])) { $snippet = new Google_VideoSnippet(); $snippet-&gt;setTitle("Test v3"); $snippet-&gt;setDescription("First upload using api v3"); $snippet-&gt;setTags(array("api","v3")); $video = new Google_Video(); $video-&gt;setSnippet($snippet); $response = $this-&gt;googleapi-&gt;youtube-&gt;videos-&gt;insert( "status,snippet", $video, array('data' =&gt; $_FILES['userfile']['tmp_name']) ); var_dump($response); }else{ $this-&gt;load-&gt;view('youtube'); } } </code></pre> <p>The response is empty, because <code>io/Google_REST.php</code> throws </p> <blockquote> <p>'Undefined index: errors' at line 70</p> </blockquote> <p>which is within <code>decodeHttpResponse()</code>, </p> <p>however, a dump from the actual response of <code>Google_Client::$io-&gt;makeRequest()</code> returns the following...</p> <pre><code>object(Google_HttpRequest)#31 (10) { ["batchHeaders":"Google_HttpRequest":private]=&gt; array(4) { ["Content-Type"]=&gt; string(16) "application/http" ["Content-Transfer-Encoding"]=&gt; string(6) "binary" ["MIME-Version"]=&gt; string(3) "1.0" ["Content-Length"]=&gt; string(0) "" } ["url":protected]=&gt; string(197) "https://www.googleapis.com/upload/youtube /v3/videos?part=status%2Csnippet&amp;uploadType=multipart&amp; key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ["requestMethod":protected]=&gt; string(4) "POST" ["requestHeaders":protected]=&gt; array(3) { ["content-type"]=&gt; string(37) "multipart/related; boundary=131050532" ["authorization"]=&gt; string(64) "BearerXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ["content-length"]=&gt; int(254) } ["postBody":protected]=&gt; string(254) "--131050532 Content-Type: application/json; charset=UTF-8 {"snippet":{"tags": ["api","v3"],"title":"Test v3","description":"First upload using api v3"}} --131050532 Content-Type: Content-Transfer-Encoding: base64 c2FtcGxlLm1wNA== --131050532--" ["userAgent":protected]=&gt; string(44) "Youtube test app google-api-php-client/0.6.0" ["responseHttpCode":protected]=&gt; int(500) ["responseHeaders":protected]=&gt; array(7) { ["server"]=&gt; string(61) "HTTP Upload Server Built on Dec 12 2012 15:53:08 (1355356388)" ["content-type"]=&gt; string(16) "application/json" ["date"]=&gt; string(29) "Wed, 19 Dec 2012 13:03:00 GMT" ["pragma"]=&gt; string(8) "no-cache" ["expires"]=&gt; string(29) "Fri, 01 Jan 1990 00:00:00 GMT" ["cache-control"]=&gt; string(35) "no-cache, no-store, must-revalidate" ["content- length"]=&gt; string(2) "52" } ["responseBody":protected]=&gt; string(52) "{ "error": { "code": 500, "message": null } } " ["accessKey"]=&gt; NULL } </code></pre> <p>Any help moving forwards with this would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload