Thinkphp uploads data based on Http

Source: Internet
Author: User
Thinkphp downloads Httppublic & nbsp; static & nbsp; function & nbsp; Download ($ Download) {& nbsp; import ("Com. download Buyback thinkphp based on Http

Public static function Download ($ Download ){
Import ("Com. Buyback. QueryAmazon ");
Import ("ORG. Net. Http ");
$ BookInformModel = M ("admin ");
$ Result = $ bookInformModel-> where ("Download = '$ download'")-> select ();
If ($ result [0] ['image'] = ""){
$ Data ['id'] = $ result [0] ['id'];
$ RemoteUrl = QueryAmazon: getImage ($ Download );
If (! Empty ($ remoteUrl ['imageurl']) {
$ LocalUrl = "oa/Tpl/Public/Upload/". $ Download. ". jpg ";
Http: curl_download ($ remoteUrl ['imageurl'], "./". $ localUrl );
} Else {
$ LocalUrl = "oa/Tpl/Public/Upload /";
}
$ Data ['image'] = $ localUrl;
$ BookInformModel-> save ($ data );
Return $ localUrl;
}
Return $ result [0] ['image'];
}

Click to download
Download
Cannot download for explanation

------ Solution --------------------
Download


Oa/Tpl/Public/Upload/{$ vo. Download} is this address correct. Whether the front side should be something or not. change it to an absolute link.

Make sure the link is correct. The problem is found.


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.