UploadAttachment API - Unable to attach (uploadFileSizeError or 502 Server Hangup)

I've got a script I'm working on, and I'm unable to upload any attachments to UploadAttachment.

I know I have no problem with OAuth (I am able to connect and get a users messages), however whenever I try the code below, I get either a 502 error (Server hangup), or an error of type uploadFileSizeError . I have tried multiple different files, both big and small, so I'm fairly certain the actual file size is not in question.

The code as it currently stands is below, and based off of code from here: http://developer.yahoo.com/forum/Yahoo-Mail-Web-Services-API/UploadAttachment-OAuth/1294208769000-c85c7452-6b71-3747-9805-6cbd25505daf

I have tried numerous enumerations of the code, and all of them have one of the above errors.

$fileContents is the base64 encoded file contents.

Does anyone have any suggestions for me to try?
          $headers = array(
"Content-Length: ".strlen($fileContents),
"Content-Type: multipart/form-data; boundary=---------------------------7da34b1d80888",
'Content-Disposition: form-data; name="_charset_"',
'Content-Disposition: form-data; name="uploadfile"; filename="C:\\'.$fileInfo[0]['orig_filename'].'"',
'Content-type: '.$fileInfo[0]['mime_type'],

$jsonClient = new \JsonRpcClient($attachOauthURLForJson, NULL);

$json = $jsonClient->__call("UploadAttachment", array("uploadfile" => '"C:\\'.$fileInfo[0]['orig_filename'].'"', "output" => "json"));

  • JB
  • Mar 7, 2012
0 Replies

Recent Posts

in Yahoo! Mail Web Services API