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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:58:38+00:00 2026-06-05T12:58:38+00:00

My application sends urlencoded or base64encoded string via http get request, the string contain

  • 0

My application sends urlencoded or base64encoded string via http get request, the string contain image data, that most be download from the php file, but i dont know how php would download image from my string that is either urlencoded or base64encoded, please help me out guys… im lost

  • 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-05T12:58:40+00:00Added an answer on June 5, 2026 at 12:58 pm

    Serve image to a user

    // we assume $imageData is PNG
    $image = urldecode($imageData);
    // or
    $image = base64_decode($imageData);
    
    // in case of force download change Content-Type: image/png to
    // application/octet-stream and Content-Disposition: inline to attachment
    header('Content-type: image/png');
    header('Content-Disposition: inline; filename=' . md5($image) . '.png');
    header('Content-Length: ' . strlen($image));
    
    echo $image;
    exit;
    

    The problem si to detect correct Content-Type if you don’t know it. But browsers should be able to autodetect it on its own.

    Some notes about caching
    PHP implicitly sends headers which prevents browser caching of retrieved data. I suggest you to set these headers manually (Cache-Control, Expires, Pragma). To work properly, every single image must be served by an unique URL. Also try to avoid of starting sessions. On heavily accessed website with public access you can easily flood webserver with redundant session files.

    Save image to a file

    $image = urlencode($imageData);
    // or
    $image = base64_decode($imageData);
    
    if (!file_put_contents('abs/path/to/save/file.png', $image)) {
        throw new Exception('Image could not be saved');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing a client application that sends images to a server via a webservice. As
I am building a console application that gathers some data and then sends it
My application sends Facebook notifications to a user. Is that possible to format the
I have an application that sends an HTML formatted email with embedded images. The
I'm building a application that sends a test message to another email, the program
I have a PHP application that sends email using the pear Mail function. Unfortunately
I created a console application which sends data from a Sql Database to RavenDB.
I have a console application that sends a XML to a MVC application and
I'm writing a WinForms application that sends email messages (like a mail merge). I'd
I want to emulate a HTTP POST using application/x-www-form-urlencoded encoding to send a option

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.