How does the Tp framework accept base64 encoded images from the ios post and save the image path?

Source: Internet
Author: User
How does the Tp framework accept base64 encoded images from the ios post and save the image path? thank you for your advice. it is best to have code. the Tp framework accepts base64 encoded images from the ios post and save Image path

Thank you for your advice.

Reply content:

How does the Tp framework accept base64 encoded images from the ios post and save the image path?

Thank you for your advice.

Simply store the decoded files in the specified directory,

Received base64 data:

$data = "data:image/jpg;base64,balabalabala...";

In a format similar to this, remove the ',' and above to get the file content.

$image_content = "balabalabala...";

Then execute

$image_content = base64_decode($image_content);

Then execute

file_input_contents($dir, $image_content)

$ Dir is the address where you want to save the image.


  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.