Issue
How can I base64 encode a file sent from one page to another via a form POST
.
The following do not work:
base64_encode($_FILES['file'])
base64_encode(file_get_contents($_FILES['file']))
base64_encode(file_get_contents($_FILES['file']['name']))
Why don't they work?
What is the correct thing to do to base64 encode the file?
Solution
tmp_name is the file path to the file that is being temporarily stored
base64_encode(file_get_contents($_FILES['file']['tmp_name']))
Answered By - PHPDave Answer Checked By - Mary Flores (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.