base64_decode

See all posts See thread Reply

Re: base64_decode  new!
by colin, 5 years, 9 months ago
Your code above cannot work anyway: you are trying to instantiate a class with a file that doesn't exist. Indeed, the filename you have is the contents of the file with an image extension, it cannot possibly work.

You should instantiate the class with raw base64 data:
$handle = new upload($data);
Reply
Re: base64_decode  new!
by Steve, 5 years, 9 months ago
Great, thanks for your help. I have changed the code as per your suggestion and the file was stored, however it is a data.txt file with base64 encoded image. How do I convert it back to jpeg image and store it?Reply
Re: base64_decode  new!
by jazzy, 3 years, 4 months ago
I think this is because of the string appear before the images string, something like " data:image/jpeg;base64, ", remove it and your image will not in .txt formatReply
Re: base64_decode  new!
by Steve, 5 years, 9 months ago
Great, thanks for your help. I have changed the code as per your suggestion and the file was stored, however it is a data.txt file with base64 encoded image. How do I convert it back to jpeg image and store it?Reply