function tcupload($file,$xcid){ $ttk=new TTKClient(MY_ACCESSKEY,MY_SECRETKEY); $res=$ttk->uploadFile($xcid,$file); $res = str_replace("{", "", $res); $res = str_replace("}", "", $res); $res = str_replace('"', "", $res); $array = explode(',',$res); $s_url = str_replace('s_url:', "", $array[7]); return stripslashes($s_url); }
<?php include_once 'tietuku_sdk.php'; define('MY_ACCESSKEY', '754efe46b0adb4ffc407a78cd52081c3613227ed'); //获取地址:http://open.tietuku.com/manager define('MY_SECRETKEY', 'da39a3ee5e6b4b0d3255bfef95601890afd80709'); //获取地址:http://open.tietuku.com/manager $ttk = new TTKClient(MY_ACCESSKEY, MY_SECRETKEY); $tempFile = $_FILES['Filedata']['tmp_name']; $res = $ttk->uploadFile('1051794', $tempFile); $ret = json_decode($res, true); echo $ret['s_url'];
function code_tie($file) { include_once './Public/uploadify/tietuku_sdk.php'; define('MY_ACCESSKEY', '754efe46b0adb4ffc407a78cd52081c3613227ed'); //获取地址:http://open.tietuku.com/manager define('MY_SECRETKEY', 'da39a3ee5e6b4b0d3255bfef95601890afd80709'); //获取地址:http://open.tietuku.com/manager $ttk = new TTKClient(MY_ACCESSKEY, MY_SECRETKEY); $files = 'http://' . $_SERVER['HTTP_HOST'] . $file; $res = $ttk->uploadFromWeb('1051794', $files); $ret = json_decode($res, true); return $ret['s_url']; }