Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6355469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:46:14+00:00 2026-05-24T22:46:14+00:00

I’m trying to use the Photobucket API. I’m planning on writing a UI in

  • 0

I’m trying to use the Photobucket API. I’m planning on writing a UI in javascript and then using AJAX calls to the server which will basically act as a proxy to the Photobucket servers. I’m using the server as a proxy so that my Photobucket API consumer_secret isn’t out in the open. However, I’m having some trouble uploading photos using PHP. I’ve been able to get other methods from the API to work including authenticated ones like adding and deleting an album. I’ve been referencing

http://pic.pbsrc.com/dev_help/WebHelpPublic/Content/Methods/Album/Upload%20Media%20to%20an%20Album.htm

and

http://pic.pbsrc.com/dev_help/WebHelpPublic/Content/Examples/Uploading%20Media.htm

I’ve never done file upload in PHP but I read some of the posts on here and various other places on the web. Basically I have a test page that has an html form that posts the user, album name, and file to a php script on my server. The form is encoded as multipart/form-data.

When the POST request makes it to the page on my server. My server looks up the tokens for the user sets and sets up the basic oauth parameters. It then does all the necessary things for oauth exactly the same to how it does them in the other methods (the ones where everything works).

I’m excluding the uploadfile parameter from the base string and am using the method POST when generating the oauth signature. For my uploadfile parameter I use the following

$params['uploadfile']= '@'.$_FILES['file']['tmp_name'];

Then I set up the curl request like so

$ch = curl_init($url.$resource);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params); // Note $params is an array

$response = curl_exec($ch);

curl_close($ch);

I’ve also tried adding in

curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible);');

However, after all of this Photobucket comes back and says “Authentication failed signature check failed”

I’ve looked at my base string and it looks fine. Here is an example. I edited out the actual values for the various tokens:

POST&http%3A%2F%2Fapi.photobucket.com%2Falbum%2Fusername%2Fupload&format%3Djson%26oauth_consumer_key%3D00000%26oauth_nonce%3D1313541553TcVIpWJ18WxEZeXO%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1313541553%26oauth_token%3D000000%26oauth_version%3D1.0%26title%3Dtitle%26type%3Dimage

I don’t think its a problem with my base string because as I said it looks fine and I have no problems with any of the other methods I’ve tried. I think it is a problem with the way curl is sending the data for two reasons.

1) I had a problem with deleting an album at first when I tried to do a delete request, and I got a similar error, however, when I simply did a post request with the added parameter _method=DELETE everything worked fine

2) This is the only method I’ve had problems with and so far it is the only method that requires the data being sent is encoded as multipart/form-data

I would have thought that it was something to do with the way I am assigning the uploadfile parameter, but it doesn’t complain about the file only the signature and the documentation said to leave that parameter out of the base string.

Does anyone have any thoughts? Right now I’m thinking that I’m missing some curl_setopt’s.

I’d compare my request sent to the example in the reference links but I don’t know how to view the body of the Curl request (I can view the headers and it does say multipart/form-data)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:46:15+00:00Added an answer on May 24, 2026 at 10:46 pm

    I didn’t realize that multipart/form-data submissions didn’t need to be raw url encoded. As soon as I stopped encoding the parameters everything worked as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm making a simple page using Google Maps API 3. My first. One marker
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.