Пример #1
0
        file_put_contents($file, $content, FILE_APPEND);
        echo "同名文件已经存在了";
        $updateback->kind = "have";
        exit;
    }
    if (!move_uploaded_file($filename, $destination)) {
        $content = "移动文件出错";
        file_put_contents($file, $content, FILE_APPEND);
        echo "移动文件出错";
        $updateback->kind = "move";
        exit;
    } else {
        $path = "http://10.192.164.102/learn/";
        $image = $path . $destination;
        $id = test_input($_POST["id"]);
        if ($updateimag->Insert_image($id, $image) == "OK") {
            $updateback->kind = "OK";
            $json = json_encode($updateback);
            echo "{$json}";
        }
    }
}
?>
  






Пример #2
0
    $object2 = "Ionic/Imagesmall/" . $imagesmall;
    $path = $destination_folder . $imagesmall;
    try {
        $ossClient->uploadFile($bucket, $object2, $path);
        $backinfo->kindsmall = "OK";
    } catch (OssException $e) {
        WriteLog("上传压缩图失败信息" . $e->getMessage());
        $backinfo->kindsmall = "NO";
    }
    unlink($path);
    if ($backinfo->kindsmall == "OK" && $backinfo->kindbig == "OK") {
        $insertimage = new CommentImage();
        $resourceid = create_guid();
        $mediaid = "DB5483ADCADC3ADC1E5CD2";
        $linkid = test_input($_POST["id"]);
        $linktype = test_input($_POST["eventtype"]);
        WriteLog("连接ID:" . $linkid . "--连接类型:" . $linktype . "\n");
        $resourcetype = "图片";
        if ($insertimage->Insert_image($resourceid, $mediaid, $linktype, $linkid, $resourcetype, $object2, $object) == "OK") {
            $backinfo->kind = "OK";
            $json = json_encode($backinfo);
            echo "{$json}";
            WriteLog("资源ID:" . $resourceid . "--成功上传截止:" . date('y-m-d h:i:s', time()) . "\n");
        } else {
            WriteLog("\n数据添加失败");
        }
    }
}
?>