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 9208363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:36:03+00:00 2026-06-18T00:36:03+00:00

I am having some trouble uploading files to Imageshack’s API. I use a multipart/form-data

  • 0

I am having some trouble uploading files to Imageshack’s API. I use a multipart/form-data form to get the file.

index.php:

<form method="post" enctype="multipart/form-data" action="upload.php">
    <input type="file" name="fileupload"/>
    <input type="submit" value="Go"/>
</form>

Normally I would have no problem with this, however the data must be sent to http://imageshack.us/upload_api.php and the response is given back in an XML styled HTML page on their server so there’s really nothing I can do with it. So I decided to pass the form through a PHP cURL script and getting the response on the same page.

upload.php:

<?php
    $url = 'http://imageshack.us/upload_api.php';
    $key = '4BEILRTV5ff57ecb70867e8becb2c4b5e695bdb4';
    $max_file_size = '5242880';
    $temp = $_FILES["fileupload"]["tmp_name"];
    $name = $_FILES["fileupload"]["name"];

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);

    $post = array(
        "fileupload" => '@' . $temp,
        "key" => $key,
        "max_file_size" => $max_file_size
    );
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    $response = curl_exec($ch);
    echo $response;
?>

At first I was getting a bunch of errors, but now I don’t get any response. Not even an error.

Any suggestions on using this method would be great!

  • 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-18T00:36:04+00:00Added an answer on June 18, 2026 at 12:36 am

    I had to include “format” => ‘json’ into the post options and use json_decode to parse the info. Here’s the upload.php script.

    <?php
        $url = 'http://imageshack.us/upload_api.php';
        $key = '4BEILRTV5ff57ecb70867e8becb2c4b5e695bdb4';
        $max_file_size = '5242880';
        $temp = $_FILES["fileupload"]["tmp_name"];
    
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_URL, $url);
    
        $post = array(
            "fileupload" => '@' . $temp,
            "key" => $key,
            "format" => 'json',
            "max_file_size" => $max_file_size,
            "Content-type" => "multipart/form-data"
        );
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
        $response = curl_exec($ch);
        $json_a=json_decode($response,true);
        echo $json_a[links][image_link];
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am uploading files and having trouble finding an answer to this question. Some
Been having some trouble implementing a single-column index in LaTeX. I've been employing the
Having some trouble declaring functions within my script: %Read the raw audio data refData
I am having trouble uploading an image with JSP in Tomcat. I had some
Having some trouble getting BIRT to allow me to create a Data Set with
im having some trouble with a file server that i made in c#. The
Im having some trouble determining how to write files using a Java Web Start
Im having some trouble reading xml files using jquery that containts swedish chars (åäö)
I am having some trouble uploading code to my Seeeduino ADK (essentially a Arduino
I'm having some trouble uploading images to my server via RestSharp. I have a

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.