How can I save the pictures I read from mysql in php to a local pic?

Source: Internet
Author: User
How can I save the pictures I read from mysql in php to a local pic? Mysql stores jpg images in the mediablob format. display I can use: & nbsp; $ showidxnumber = $ _ GET ["idx_num"]; & nbsp; $ result = mys in php, how do I save the image I read from mysql as a local pic?
Mysql stores jpg images in the mediablob format.

Display I can use:
$ Showidxnumber = $ _ GET ["idx_num"];
$ Result = mysql_query ("SELECT * FROM ecard WHERE picidx = $ showidxnumber ");
$ Row = mysql_fetch_object ($ result );
Echo $ row-> picdata;

However, there is a new requirement to save the image locally, for example, to save it as c: \ a.jpg. how do I write the code? Thank you for choosing. php mysql.
------ Solution --------------------
File_put_contents ('C: \ a.jpg ', $ row-> picdata );

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.