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

  • Home
  • SEARCH
  • 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 8570727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:37:24+00:00 2026-06-11T18:37:24+00:00

i am trying to upload a file to box.com with their v2 api. i

  • 0

i am trying to upload a file to box.com with their v2 api.
i am able to successfully upload a file with curl, but cannot upload a file from my rails application. i am passing my upload function the correct folder id and file is a tempfile object created by a form upload in my app.

here is the successful curl command

 curl https://upload.box.com/api/2.0/files/data -H "Authorization: BoxAuth api_key=API_KEY&auth_token=TOKEN" -F contract=@test.png -F folder_id=387656851 -ssl3

and here is my ruby code

class BoxApi

require 'httmultiparty'
include HTTMultiParty
ssl_version :SSLv3

def initialize
    @key = API_KEY
    @token = TOKEN
end

def upload_file(folder_id,file,filename,content_type)
    File.open(file) do |open_file|
        response = self.class.post('https://upload.box.com/2.0/files/data', :query => {
            :file => open_file,
            :folder_id => folder_id
            }, :headers => {'Authorization' => "BoxAuth api_key=#{@key}&auth_token=#{@token}"})
        p response
    end

end

i get an html page back from box with this text
It appears that your firewall may be blocking Box or you are encountering an error.

Please contact your IT administrator to configure your firewall to recognize all sub-domains of .box.com, .box.com and .boxcdn.net. The ports that should be opened for these domains are 80 and 443.

If that does not resolve the issue, then please submit a support ticket at https://www.box.com/help.

any ideas why the curl command would be working but not the ruby code?

  • 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-06-11T18:37:26+00:00Added an answer on June 11, 2026 at 6:37 pm

    This works properly for me

    require 'httmultiparty'
    
    class SomeClient
      include HTTMultiParty
      base_uri 'https://api.box.com/2.0'
    end
    
    response = SomeClient.post('/files/data', 
        :headers => { 'authorization' => 'BoxAuth api_key={YOUR API KEY}&auth_token={YOUR TOKEN' },
        :body => { :folder_id      => '0', :somefile => File.new('large.jpeg')}
    )
    

    I would try to verify that

    1. You can make non-upload API calls (i.e. GET /folders/0)
    2. If not, check your firewall settings.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to upload a file using the HTML File Api but I
friends, i am trying to upload file to php server using following tutorial http://getablogger.blogspot.com/2008/01/android-how-to-post-file-to-php-server.html
I am trying to upload file to FTP server using php but it is
I am trying to upload file to my youtube account but somehow I can't
I'm working on a ruby application, and am trying to upload a file to
I am trying to do a file upload from gwt-ext without bringing up the
I am trying to upload a file using Apache tomhawk with JSF 2.0, but
I am trying to upload a file using jQuery ajax, but keep getting this
I am trying to upload a file to a ftp server using libcurl but
hi friends iam trying to upload a file from the android device to the

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.