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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:43:49+00:00 2026-06-01T01:43:49+00:00

I want to encode binary file into base64 and put it into php page

  • 0

I want to encode binary file into base64 and put it into php page (inline with the code), And when request that page it streams the file to the browser,popup a download dialog.

Any ideas

  • 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-01T01:43:50+00:00Added an answer on June 1, 2026 at 1:43 am

    Seems pretty straightforward. As with readfile, use http headers to force download, and then echo the encoded string.

    $decoded_data = base64_decode($encoded_data);
    
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . strlen($decoded_data);
    ob_clean();
    flush();
    echo $decoded_data;
    exit;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say you have a List<List<Boolean>> and you want to encode that into binary
I have a binary file which i want to embed directly into my source
As the title mentioned, I want to encode a Image Obj into some kind
I have an AVI file, which I want to re-encode to fit on a
I want to encode this 广东路20号外滩5号7楼,近中山东一路 into this: %e5%b9%bf%e4%b8%9c%e8%b7%af%32%30%e5%8f%b7%e5%a4%96%e6%bb%a9%35%e5%8f%b7%37%e6%a5%bc%ef%bc%8c%e8%bf%91%e4%b8%ad%e5%b1%b1%e4%b8%9c%e4%b8%80%e8%b7%af however urlencode() doesn't seem to
I have a long string that I want to encode to ascii. I'm doing:
I want to encode/compress some binary image data as a sequence if bits. (This
I want to encode a set of configuration options into a long string of
If you have binary data that you need to encode, what encoding scheme do
I've got a unicode string (s) which I want to write into a file.

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.