zoukankan      html  css  js  c++  java
  • 通过数据流上传文件

        function test(&$id, &$img){
            $photodata = file_get_contents($img);
            $url = UPLOAD_IMAGE_URL;
    //        if ($compress == 'N') {
    //            $url = UPLOAD_IMAGE_URL . '&compress=n';
    //        }
    
            $upload = http_parse_message(http_post_data($url, $photodata));
            $result = (array) $upload;
            if (!empty($result) && $result['body']) {
                $newPicId = explode("=", $result['body']);
                if (!empty($newPicId[1]) && $newPicId[1] > 0) {
                    $result[0] = true;
                    $id = Lib_String::filterBlank(($newPicId[1]));
                } elseif (!empty($newPicId[1]) && $newPicId[1] <= 0) {
                    $result[0] = false;
                    $result[1] = "上传失败";
                } else {
                    $result[0] = false;
                    $result[1] = "上传失败";
                }
            } else {
                $result[0] = false;
                $result[1] = "上传失败";
            }
        }
        public static function filterBlank($str) {
            mb_regex_encoding('utf-8');
            $str = mb_ereg_replace(' ', '', $str);
            return trim($str);
        }
  • 相关阅读:
    NAT和PAT
    谷歌浏览器如何正确离线网页
    安全
    VLAN
    交换
    动态路由
    静态路由
    配置Cisco网络设备
    导数表和基本积分表
    HNOI/AHOI2018题解
  • 原文地址:https://www.cnblogs.com/bugY/p/3336926.html
Copyright © 2011-2022 走看看