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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:20:39+00:00 2026-05-15T03:20:39+00:00

I’m using AS3 to base64 encode a JPG and pass it to Javascript. I’m

  • 0

I’m using AS3 to base64 encode a JPG and pass it to Javascript. I’m attempting to use AJAX to pass that base64 encoded string to PHP and have PHP decode it. (I know I could send it back to Flash and Flash could decode it and send it to PHP, but I’m trying to eliminate the need for Flash on the decoding end).

It appears that AS3’s encodeToBase64String() function and and PHP’s base64_decode() function do not use the same algorithm, as PHP evaluates it as a base64 encoded object, but does not seem to output it properly.

Is there a way to rectify this problem?

Note: Please no posts about not needing Javascript. Javascript is a necessary step for reasons not detailed here.

  • 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-15T03:20:40+00:00Added an answer on May 15, 2026 at 3:20 am

    Not sure about what might be causing trouble. I’ve passed base64 encoded data to php from AS3 a lot of times and haven’t run into problems.

    I generally use Hurlant’s Base64::encodeByteArray() in the AS3 side, though.

    Edit

    Something like this might help debugging this problem:

            var buffer:ByteArray = new ByteArray();
            for(var i:int = 0; i < 256; i++) {
                buffer[i] = i;
            }
    
            var str:String = Base64.encodeByteArray(buffer); // this is com.hurlant.util.Base64
            // post your data to your php (directly or through JS)
    

    Php test code:

    $str = $_REQUEST['str'];
    
    $decoded = base64_decode($str);
    file_put_contents("test.txt",$decoded);
    

    In the AS side, you are sending a string that encodes every possible byte value. The php will decode it and write it to a file. Now, if you open the generated file with an hex editor, you should see all the numbers from 0 to 255 (or 0x00 … 0xff). If this is not the case, this might give some hints on what’s causing the problems.

    PS: I’d post from AS to PHP directly just to simplify troubleshooting. Maybe JS is messing with your data somehow (not likely since base64 should be safe); but just to discard a possible source of the problem.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
I am reading a book about Javascript and jQuery and using one of the
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

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.